]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: if head object does not have data, still include in `object manifest` 55842/head
authorJ. Eric Ivancich <ivancich@redhat.com>
Fri, 9 Feb 2024 17:27:00 +0000 (12:27 -0500)
committerJ. Eric Ivancich <ivancich@redhat.com>
Thu, 29 Feb 2024 14:46:03 +0000 (09:46 -0500)
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 <ivancich@redhat.com>
(cherry picked from commit 575362d826f8f58832a2bb865b9dc73c474f4fe1)

src/rgw/rgw_admin.cc

index 081204c24f4474abcb7f058cb32f5f77d22ffd86..5fecee0dc023cc8786f43765d387853b1a59c477 100644 (file)
@@ -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