From: David Zafman Date: Fri, 23 Nov 2018 07:52:56 +0000 (-0800) Subject: ceph-objectstore-tool: Dump hinfo when available for objects X-Git-Tag: v12.2.12~94^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=ddbaf98bc1e30903f338b227b411598f722927bf;p=ceph.git ceph-objectstore-tool: Dump hinfo when available for objects Fixes: http://tracker.ceph.com/issues/37597 Signed-off-by: David Zafman (cherry picked from commit fd19c47a450bee80e6fafb1a47e13054d1fa0fab) Conflicts: src/tools/ceph_objectstore_tool.cc Changed 'cbegin()' to 'begin()' and changed 'ch' to 'coll' as connection handler was introduced in mimic. --- diff --git a/src/tools/ceph_objectstore_tool.cc b/src/tools/ceph_objectstore_tool.cc index 2d47a47cfd6..208db5351f5 100644 --- a/src/tools/ceph_objectstore_tool.cc +++ b/src/tools/ceph_objectstore_tool.cc @@ -35,6 +35,7 @@ #include "osd/PGLog.h" #include "osd/OSD.h" #include "osd/PG.h" +#include "osd/ECUtil.h" #include "json_spirit/json_spirit_value.h" #include "json_spirit/json_spirit_reader.h" @@ -2399,6 +2400,22 @@ int print_obj_info(ObjectStore *store, coll_t coll, ghobject_t &ghobj, Formatter formatter->close_section(); } } + bufferlist hattr; + gr = store->getattr(coll, ghobj, ECUtil::get_hinfo_key(), hattr); + if (gr == 0) { + ECUtil::HashInfo hinfo; + auto hp = hattr.begin(); + try { + decode(hinfo, hp); + formatter->open_object_section("hinfo"); + hinfo.dump(formatter); + formatter->close_section(); + } catch (...) { + r = -EINVAL; + cerr << "Error decoding hinfo on : " << make_pair(coll, ghobj) << ", " + << cpp_strerror(r) << std::endl; + } + } formatter->close_section(); formatter->flush(cout); cout << std::endl;