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>
encode(call, in);
librados::ObjectWriteOperation op;
+ op.assert_exists();
op.exec(RGW_CLASS, RGW_BI_LOG_TRIM, in);
cn = stack->create_completion_notifier();
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;