Skip to content

Commit a74fd8b

Browse files
committed
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 <[email protected]>
1 parent 8f604ea commit a74fd8b

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

src/rgw/driver/rados/rgw_cr_rados.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,7 @@ int RGWRadosBILogTrimCR::send_request(const DoutPrefixProvider *dpp)
704704
encode(call, in);
705705

706706
librados::ObjectWriteOperation op;
707+
op.assert_exists();
707708
op.exec(RGW_CLASS, RGW_BI_LOG_TRIM, in);
708709

709710
cn = stack->create_completion_notifier();

src/rgw/driver/rados/rgw_trim_bilog.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -791,6 +791,12 @@ int BucketTrimInstanceCR::operate(const DoutPrefixProvider *dpp)
791791
set_status("trimming bilog shards");
792792
yield call(new BucketTrimShardCollectCR(dpp, store, *pbucket_info, totrim.layout.in_index,
793793
min_markers));
794+
if (retcode == -ENOENT) {
795+
// this is not a fatal error to retry, as the shard seems to not exist
796+
// anymore. This can happen if the shard was removed unexpectedly.
797+
// should be already logged by the BucketTrimShardCollectCR().
798+
retcode = 0;
799+
}
794800
if (retcode < 0) {
795801
ldpp_dout(dpp, 4) << "failed to trim bilog shards: "
796802
<< cpp_strerror(retcode) << dendl;

0 commit comments

Comments
 (0)