From: J. Eric Ivancich Date: Tue, 18 Mar 2025 19:10:35 +0000 (-0400) Subject: rgw: radolist clean up, calculate obj info slightly earlier X-Git-Tag: v18.2.8~10^2~211^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=a3d367ee61fa5c419c0df4c882f0419ce8e61539;p=ceph.git rgw: radolist clean up, calculate obj info slightly earlier With recent changes, it's better to determine bucket and object names earlier. Signed-off-by: J. Eric Ivancich (cherry picked from commit 60b1bc4cd5eddd0133cec6f1e286db131056fea1) --- diff --git a/src/rgw/rgw_orphan.cc b/src/rgw/rgw_orphan.cc index 8fcb731d51cf..8efdf7a72e93 100644 --- a/src/rgw/rgw_orphan.cc +++ b/src/rgw/rgw_orphan.cc @@ -926,9 +926,9 @@ int RGWOrphanSearch::finish() int RGWRadosList::handle_stat_result(const DoutPrefixProvider *dpp, RGWRados::Object::Stat::Result& result, - std::string& bucket_name, - rgw_obj_key& obj_key, - std::set& obj_oids) + const std::string& bucket_name, + const rgw_obj_key& obj_key, + std::set& obj_oids) { obj_oids.clear(); @@ -952,9 +952,6 @@ int RGWRadosList::handle_stat_result(const DoutPrefixProvider *dpp, return 0; } - bucket_name = bucket.name; - obj_key = result.obj.key; - if (!result.manifest) { /* a very very old object, or part of a multipart upload during upload */ obj_oids.insert(oid); @@ -1056,22 +1053,21 @@ int RGWRadosList::pop_and_handle_stat_op( RGWObjectCtx& obj_ctx, std::deque& ops) { - std::string bucket_name; - rgw_obj_key obj_key; std::set obj_oids; RGWRados::Object::Stat& front_op = ops.front(); int ret = front_op.wait(dpp); + // note: even if we get an error, front_op.result.obj will still be + // populated with correct data + const std::string bucket_name = front_op.result.obj.bucket.name; + const rgw_obj_key obj_key = front_op.result.obj.key; + 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); - // 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) { diff --git a/src/rgw/rgw_orphan.h b/src/rgw/rgw_orphan.h index db811d31d9a5..9c1a6a0c8678 100644 --- a/src/rgw/rgw_orphan.h +++ b/src/rgw/rgw_orphan.h @@ -259,8 +259,8 @@ class RGWRadosList { int handle_stat_result(const DoutPrefixProvider *dpp, RGWRados::Object::Stat::Result& result, - std::string& bucket_name, - rgw_obj_key& obj_key, + const std::string& bucket_name, + const rgw_obj_key& obj_key, std::set& obj_oids); int pop_and_handle_stat_op(const DoutPrefixProvider *dpp, RGWObjectCtx& obj_ctx,