From d0f01cfbb9cb95c75ab709beddf255bd818bf93b Mon Sep 17 00:00:00 2001 From: Casey Bodley Date: Tue, 18 Jan 2022 20:39:37 -0500 Subject: [PATCH] rgw: RGWBucket::sync() no longer duplicates datalog/bilog entries RGWSI_BucketIndex_RADOS::handle_overwrite() is already writing the datalog/bilog entries related to BUCKET_DATASYNC_DISABLED RGWBucket::sync() calls handle_overwrite() indirectly from bucket->put_info() when it writes the bucket instance with this new BUCKET_DATASYNC_DISABLED flag, so RGWBucket::sync() shouldn't duplicate those writes here Signed-off-by: Casey Bodley --- src/rgw/rgw_bucket.cc | 31 ++----------------------------- 1 file changed, 2 insertions(+), 29 deletions(-) diff --git a/src/rgw/rgw_bucket.cc b/src/rgw/rgw_bucket.cc index 68da8bc761b34..7af7c5c31e4a8 100644 --- a/src/rgw/rgw_bucket.cc +++ b/src/rgw/rgw_bucket.cc @@ -674,41 +674,14 @@ int RGWBucket::sync(RGWBucketAdminOpState& op_state, const DoutPrefixProvider *d bucket->get_info().flags |= BUCKET_DATASYNC_DISABLED; } + // when writing this metadata, RGWSI_BucketIndex_RADOS::handle_overwrite() + // will write the corresponding datalog and bilog entries int r = bucket->put_info(dpp, false, real_time()); if (r < 0) { set_err_msg(err_msg, "ERROR: failed writing bucket instance info:" + cpp_strerror(-r)); return r; } - int shards_num = bucket->get_info().layout.current_index.layout.normal.num_shards? bucket->get_info().layout.current_index.layout.normal.num_shards : 1; - int shard_id = bucket->get_info().layout.current_index.layout.normal.num_shards? 0 : -1; - const auto& log_layout = bucket->get_info().layout.logs.back(); - - if (!sync) { - r = static_cast(store)->svc()->bilog_rados->log_stop(dpp, bucket->get_info(), log_layout, -1); - if (r < 0) { - set_err_msg(err_msg, "ERROR: failed writing stop bilog:" + cpp_strerror(-r)); - return r; - } - } else { - r = static_cast(store)->svc()->bilog_rados->log_start(dpp, bucket->get_info(), log_layout, -1); - if (r < 0) { - set_err_msg(err_msg, "ERROR: failed writing resync bilog:" + cpp_strerror(-r)); - return r; - } - } - - for (int i = 0; i < shards_num; ++i, ++shard_id) { - r = static_cast(store) - ->svc()->datalog_rados->add_entry(dpp, bucket->get_info(), - bucket->get_info().layout.logs.back(), - shard_id); - if (r < 0) { - set_err_msg(err_msg, "ERROR: failed writing data log:" + cpp_strerror(-r)); - return r; - } - } - return 0; } -- 2.39.5