From: Seena Fallah Date: Mon, 31 Mar 2025 20:15:42 +0000 (+0200) Subject: rgw: avoid shard recreation during bilog trimming if it doesn't exist X-Git-Tag: v20.3.0~147^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=a74fd8bfd0c1be740647f60d5d73c9fc96dcc32a;p=ceph.git rgw: avoid shard recreation during bilog trimming if it doesn't exist 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 --- diff --git a/src/rgw/driver/rados/rgw_cr_rados.cc b/src/rgw/driver/rados/rgw_cr_rados.cc index ddc8f152d8ea..6e680d3859ec 100644 --- a/src/rgw/driver/rados/rgw_cr_rados.cc +++ b/src/rgw/driver/rados/rgw_cr_rados.cc @@ -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(); diff --git a/src/rgw/driver/rados/rgw_trim_bilog.cc b/src/rgw/driver/rados/rgw_trim_bilog.cc index f89db36980bd..32e0adfc528b 100644 --- a/src/rgw/driver/rados/rgw_trim_bilog.cc +++ b/src/rgw/driver/rados/rgw_trim_bilog.cc @@ -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;