Skip to content

Commit 5549c10

Browse files
authored
Merge pull request ceph#62571 from clwluvw/trim-log-cleanup
rgw: BucketTrimShardCollectCR expect ENODATA as empty Reviewed-by: Casey Bodley <[email protected]>
2 parents 4a7ac99 + a74fd8b commit 5549c10

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

src/rgw/driver/rados/rgw_cr_rados.cc

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

718718
librados::ObjectWriteOperation op;
719+
op.assert_exists();
719720
op.exec(RGW_CLASS, RGW_BI_LOG_TRIM, in);
720721

721722
cn = stack->create_completion_notifier();

src/rgw/driver/rados/rgw_trim_bilog.cc

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ class BucketTrimShardCollectCR : public RGWShardCollectCR {
367367
size_t i{0}; //< index of current shard marker
368368

369369
int handle_result(int r) override {
370-
if (r == -ENOENT) { // ENOENT is not a fatal error
370+
if (r == -ENODATA) { // ENODATA is not a fatal error
371371
return 0;
372372
}
373373
if (r < 0) {
@@ -857,9 +857,11 @@ int BucketTrimInstanceCR::operate(const DoutPrefixProvider *dpp)
857857
set_status("trimming bilog shards");
858858
yield call(new BucketTrimShardCollectCR(dpp, store, *pbucket_info, totrim.layout.in_index,
859859
min_markers));
860-
// ENODATA just means there were no keys to trim
861-
if (retcode == -ENODATA) {
862-
retcode = 0;
860+
if (retcode == -ENOENT) {
861+
// this is not a fatal error to retry, as the shard seems to not exist
862+
// anymore. This can happen if the shard was removed unexpectedly.
863+
// should be already logged by the BucketTrimShardCollectCR().
864+
retcode = 0;
863865
}
864866
if (retcode < 0) {
865867
ldpp_dout(dpp, 4) << "failed to trim bilog shards: "

0 commit comments

Comments
 (0)