]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: modify radoslist to better support the rgw-gap-list tool
authorJ. Eric Ivancich <ivancich@redhat.com>
Tue, 18 Mar 2025 18:33:42 +0000 (14:33 -0400)
committerJ. Eric Ivancich <ivancich@redhat.com>
Thu, 20 Mar 2025 19:31:55 +0000 (15:31 -0400)
When the `radosgw-admin bucket radoslist ...` sub-command was
introduced, it was written specifically for finding orphans. It has
since been updated to work for finding gaps, that is indexed RGW
objects that are missing one or more supporting rados objects.

When a head object was not found, it was ignored. Now it does produce
output with the oid and related information for the missing head
object.

Signed-off-by: J. Eric Ivancich <ivancich@redhat.com>
(cherry picked from commit de2023f4fcac9144276e14814d428bb1edc7b85e)

src/rgw/rgw_orphan.cc

index c0c4e75aa934d0662978499593b9ee0cd6600bc8..8fcb731d51cf8f549c6d195b5c56fa94ee1939f6 100644 (file)
@@ -1062,18 +1062,30 @@ int RGWRadosList::pop_and_handle_stat_op(
   RGWRados::Object::Stat& front_op = ops.front();
 
   int ret = front_op.wait(dpp);
-  if (ret < 0) {
-    if (ret != -ENOENT) {
-      ldpp_dout(dpp, -1) << "ERROR: stat_async() returned error: " <<
-       cpp_strerror(-ret) << dendl;
-    }
-    goto done;
-  }
+  if (ret == -ENOENT) {
+    const auto& result = front_op.result;
+    const rgw_bucket& bucket = result.obj.bucket;
+    const std::string oid = bucket.marker + "_" + result.obj.get_oid();
+    obj_oids.insert(oid);
 
-  ret = handle_stat_result(dpp, front_op.result, bucket_name, obj_key, obj_oids);
-  if (ret < 0) {
-    ldpp_dout(dpp, -1) << "ERROR: handle_stat_result() returned error: " <<
+    // needed for the processing below
+    bucket_name = result.obj.bucket.name;
+    obj_key = result.obj.key;
+
+    ldpp_dout(dpp, -1) << "ERROR: " << __func__ <<
+      ": stat of head object resulted in ENOENT; oid=" << oid << dendl;
+  } else if (ret < 0) {
+    ldpp_dout(dpp, -1) << "ERROR: " << __func__ <<
+      ": stat_async() returned error: " <<
       cpp_strerror(-ret) << dendl;
+    goto done;
+  } else {
+    ret = handle_stat_result(dpp, front_op.result, bucket_name, obj_key, obj_oids);
+    if (ret < 0) {
+      ldpp_dout(dpp, -1) << "ERROR: " << __func__ <<
+       ": handle_stat_result() returned error: " <<
+       cpp_strerror(-ret) << dendl;
+    }
   }
 
   // output results
@@ -1095,6 +1107,7 @@ done:
   obj_ctx.invalidate(front_op.result.obj);
 
   ops.pop_front();
+
   return ret;
 }