]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: radolist clean up, calculate obj info slightly earlier 62418/head
authorJ. Eric Ivancich <ivancich@redhat.com>
Tue, 18 Mar 2025 19:10:35 +0000 (15:10 -0400)
committerJ. Eric Ivancich <ivancich@redhat.com>
Thu, 20 Mar 2025 19:31:55 +0000 (15:31 -0400)
With recent changes, it's better to determine bucket and object names
earlier.

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

src/rgw/rgw_orphan.cc
src/rgw/rgw_orphan.h

index 8fcb731d51cf8f549c6d195b5c56fa94ee1939f6..8efdf7a72e93b9c3ec00bca3cc308fda1d734b8a 100644 (file)
@@ -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<string>& obj_oids)
+                                    const std::string& bucket_name,
+                                    const rgw_obj_key& obj_key,
+                                    std::set<string>& 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<RGWRados::Object::Stat>& ops)
 {
-  std::string bucket_name;
-  rgw_obj_key obj_key;
   std::set<std::string> 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) {
index db811d31d9a561ba281cfca815a9e3995ef6fa1a..9c1a6a0c867851e81b01ccbea693bbfdb714b2ea 100644 (file)
@@ -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<std::string>& obj_oids);
   int pop_and_handle_stat_op(const DoutPrefixProvider *dpp,
                              RGWObjectCtx& obj_ctx,