]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: avoid shard recreation during bilog trimming if it doesn't exist 62571/head
authorSeena Fallah <seenafallah@gmail.com>
Mon, 31 Mar 2025 20:15:42 +0000 (22:15 +0200)
committerSeena Fallah <seenafallah@gmail.com>
Mon, 31 Mar 2025 21:13:02 +0000 (23:13 +0200)
When trimming bilogs, avoid recreating shards that don't exist. Instead,
calling assert_exists() will return ENOENT, and the result will be logged
in handle_result() without unnecessary shard creation.

Signed-off-by: Seena Fallah <seenafallah@gmail.com>
src/rgw/driver/rados/rgw_cr_rados.cc
src/rgw/driver/rados/rgw_trim_bilog.cc

index ddc8f152d8eadda6c2d71be5c659581fb875a764..6e680d3859eccea2c3f1174de684908b2cda2a14 100644 (file)
@@ -704,6 +704,7 @@ int RGWRadosBILogTrimCR::send_request(const DoutPrefixProvider *dpp)
   encode(call, in);
 
   librados::ObjectWriteOperation op;
+  op.assert_exists();
   op.exec(RGW_CLASS, RGW_BI_LOG_TRIM, in);
 
   cn = stack->create_completion_notifier();
index f89db36980bd4a91d24ad703b985c0e9e5c7c681..32e0adfc528be02576278e202f32c7b9720c864d 100644 (file)
@@ -791,6 +791,12 @@ int BucketTrimInstanceCR::operate(const DoutPrefixProvider *dpp)
       set_status("trimming bilog shards");
       yield call(new BucketTrimShardCollectCR(dpp, store, *pbucket_info, totrim.layout.in_index,
                                              min_markers));
+      if (retcode == -ENOENT) {
+        // this is not a fatal error to retry, as the shard seems to not exist
+        // anymore. This can happen if the shard was removed unexpectedly.
+        // should be already logged by the BucketTrimShardCollectCR().
+        retcode = 0;
+      }
       if (retcode < 0) {
        ldpp_dout(dpp, 4) << "failed to trim bilog shards: "
                          << cpp_strerror(retcode) << dendl;