Skip to content

Commit

Permalink
add guard_reshard to RGWRados::Bucket::UpdateIndex::complete_del
Browse files Browse the repository at this point in the history
  • Loading branch information
bgy217 committed Apr 18, 2024
1 parent f720bcb commit 178045e
Showing 1 changed file with 13 additions and 15 deletions.
28 changes: 13 additions & 15 deletions src/rgw/rgw_rados.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6080,6 +6080,7 @@ int RGWRados::Bucket::UpdateIndex::complete(int64_t poolid, uint64_t epoch,
return 0;
}
RGWRados *store = target->get_store();
BucketShard *bs;

rgw_bucket_dir_entry ent;
obj.key.get_index_key(&ent.key);
Expand All @@ -6105,16 +6106,15 @@ int RGWRados::Bucket::UpdateIndex::complete(int64_t poolid, uint64_t epoch,

// Follows up the bucket shards that may have changed during the data write.
// Wait for resharding that may be in progress.
int ret = guard_reshard(nullptr, [&](BucketShard *bs) -> int {
int comp_add_ret = store->cls_obj_complete_add(*bs, obj, optag, poolid, epoch, ent, category, remove_objs, bilog_flags, zones_trace);

int log_add_ret = store->svc.datalog_rados->add_entry(target->bucket_info, bs->shard_id);
if (log_add_ret < 0) {
lderr(store->ctx()) << "ERROR: failed writing data log" << dendl;
}
return comp_add_ret;
int ret = guard_reshard(&bs, [&](BucketShard *bs) -> int {
return store->cls_obj_complete_add(*bs, obj, optag, poolid, epoch, ent, category, remove_objs, bilog_flags, zones_trace);
});

int r = store->svc.datalog_rados->add_entry(target->bucket_info, bs->shard_id);
if (r < 0) {
lderr(store->ctx()) << "ERROR: failed writing data log" << dendl;
}

return ret;
}

Expand All @@ -6128,13 +6128,11 @@ int RGWRados::Bucket::UpdateIndex::complete_del(int64_t poolid, uint64_t epoch,
RGWRados *store = target->get_store();
BucketShard *bs;

int ret = get_bucket_shard(&bs);
if (ret < 0) {
ldout(store->ctx(), 5) << "failed to get BucketShard object: ret=" << ret << dendl;
return ret;
}

ret = store->cls_obj_complete_del(*bs, optag, poolid, epoch, obj, removed_mtime, remove_objs, bilog_flags, zones_trace);
// Follows up the bucket shards that may have changed during the data deletion.
// Wait for resharding that may be in progress.
int ret = guard_reshard(&bs, [&](BucketShard *bs) -> int {
return store->cls_obj_complete_del(*bs, optag, poolid, epoch, obj, removed_mtime, remove_objs, bilog_flags, zones_trace);
});

int r = store->svc.datalog_rados->add_entry(target->bucket_info, bs->shard_id);
if (r < 0) {
Expand Down

0 comments on commit 178045e

Please sign in to comment.