From: J. Eric Ivancich Date: Fri, 9 Feb 2024 17:27:00 +0000 (-0500) Subject: rgw: if head object does not have data, still include in `object manifest` X-Git-Tag: v19.1.0~249^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F55842%2Fhead;p=ceph.git rgw: if head object does not have data, still include in `object manifest` In order to enable users who might like to use `radosgw-admin object manifest ...` to get a complete list of raw objects that comprise the RGW object, we'll include the head object when it includes not data. It will be indicated with an "index" of -1. Signed-off-by: J. Eric Ivancich (cherry picked from commit 575362d826f8f58832a2bb865b9dc73c474f4fe1) --- diff --git a/src/rgw/rgw_admin.cc b/src/rgw/rgw_admin.cc index 081204c24f44..5fecee0dc023 100644 --- a/src/rgw/rgw_admin.cc +++ b/src/rgw/rgw_admin.cc @@ -8411,9 +8411,30 @@ next: RGWRados* rados = store->getRados(); + rgw_obj head_obj = obj->get_obj(); + rgw_raw_obj raw_head_obj; + store->get_raw_obj(m.get_head_placement_rule(), head_obj, &raw_head_obj); + formatter->open_array_section("objects"); unsigned index = 0; for (auto p = m.obj_begin(dpp()); p != m.obj_end(dpp()); ++p, ++index) { + rgw_raw_obj raw_obj = p.get_location().get_raw_obj(rados); + + if (index == 0 && raw_obj != raw_head_obj) { + // we have a head object without data, so let's include it + formatter->open_object_section("object"); // name not displayed since in array + + formatter->dump_int("index", -1); + formatter->dump_unsigned("offset", 0); + formatter->dump_unsigned("size", 0); + + formatter->open_object_section("raw_obj"); + raw_head_obj.dump(formatter.get()); + formatter->close_section(); // raw_obj + + formatter->close_section(); // object + } + formatter->open_object_section("object"); // name not displayed since in array formatter->dump_unsigned("index", index); @@ -8423,7 +8444,7 @@ next: formatter->dump_unsigned("size", p.get_stripe_size()); formatter->open_object_section("raw_obj"); - p.get_location().get_raw_obj(rados).dump(formatter.get()); + raw_obj.dump(formatter.get()); formatter->close_section(); // raw_obj formatter->close_section(); // object