Skip to content
This repository has been archived by the owner on Feb 8, 2024. It is now read-only.

Commit

Permalink
rgw: [CORTX-32693] Improve output of GC list
Browse files Browse the repository at this point in the history
Added is_multipart flag in GC list output updated deletion time to human readable time format.

Signed-off-by: Jeet Jain <jeet.jain@seagate.com>
  • Loading branch information
jjxsg authored and Sachin Punadikar committed Aug 22, 2022
1 parent db76065 commit 5c7a38b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/rgw/motr/gc/gc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -427,11 +427,20 @@ int MotrGC::list(std::vector<std::unordered_map<std::string, std::string>> &gc_e
motr_gc_obj_info ginfo;
ginfo.decode(blitr);
std::unordered_map<std::string, std::string> mp;
char t_str[100];
std::string deletion_time;
if (std::strftime(t_str, sizeof(t_str), "%Y-%m-%dT%H:%M:%S%z%Z", std::localtime(&ginfo.deletion_time))) {
deletion_time = t_str;
}
else {
deletion_time = std::to_string(ginfo.deletion_time);
}
mp["tag"] = ginfo.tag;
mp["name"] = ginfo.name;
mp["deletion_time"] = std::to_string(ginfo.deletion_time);
mp["deletion_time"] = deletion_time;
mp["size"] = std::to_string(ginfo.size);
mp["size_actual"] = std::to_string(ginfo.size_actual);
mp["is_multipart"] = ginfo.is_multipart ? "true" : "false";
gc_entries.push_back(mp);
ldout(cct, 70) << ginfo.tag << ", "
<< ginfo.name << ", "
Expand Down
1 change: 1 addition & 0 deletions src/rgw/rgw_admin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7829,6 +7829,7 @@ int main(int argc, const char **argv)
formatter->dump_string("deletion_time", ginfo["deletion_time"]);
formatter->dump_string("size", ginfo["size"]);
formatter->dump_string("size_actual", ginfo["size_actual"]);
formatter->dump_string("is_multipart", ginfo["is_multipart"]);
formatter->close_section();
}
formatter->close_section();
Expand Down

0 comments on commit 5c7a38b

Please sign in to comment.