From: J. Eric Ivancich Date: Tue, 18 Mar 2025 18:33:42 +0000 (-0400) Subject: rgw: modify radoslist to better support the rgw-gap-list tool X-Git-Tag: v20.3.0~304^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=de2023f4fcac9144276e14814d428bb1edc7b85e;p=ceph.git rgw: modify radoslist to better support the rgw-gap-list tool 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 --- diff --git a/src/rgw/radosgw-admin/orphan.cc b/src/rgw/radosgw-admin/orphan.cc index 7808bf8ea61d..35865174dead 100644 --- a/src/rgw/radosgw-admin/orphan.cc +++ b/src/rgw/radosgw-admin/orphan.cc @@ -1066,18 +1066,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 @@ -1099,6 +1111,7 @@ done: obj_ctx.invalidate(front_op.result.obj); ops.pop_front(); + return ret; }