From b952558adcffc1f5daa7574196b468579666ab06 Mon Sep 17 00:00:00 2001 From: liangmingyuan Date: Wed, 7 Feb 2024 18:37:31 +0800 Subject: [PATCH] rgw/reshard: Add logrecord phase in resharding Define a new status for reshard named IN_LOGRECORD, which will be used later for recording the index ops written when a bucket is resharding. Signed-off-by: Mingyuan Liang --- src/cls/rgw/cls_rgw_types.h | 17 +++++++++++++++-- src/rgw/driver/rados/rgw_bucket.cc | 1 + src/rgw/rgw_common.cc | 1 - 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/cls/rgw/cls_rgw_types.h b/src/cls/rgw/cls_rgw_types.h index 3ef1555873d..de10671e290 100644 --- a/src/cls/rgw/cls_rgw_types.h +++ b/src/cls/rgw/cls_rgw_types.h @@ -716,8 +716,9 @@ inline bool operator!=(const rgw_bucket_category_stats& lhs, enum class cls_rgw_reshard_status : uint8_t { NOT_RESHARDING = 0, - IN_PROGRESS = 1, - DONE = 2 + IN_LOGRECORD = 1, + IN_PROGRESS = 2, + DONE = 3 }; std::ostream& operator<<(std::ostream&, cls_rgw_reshard_status); @@ -726,6 +727,8 @@ inline std::string to_string(const cls_rgw_reshard_status status) switch (status) { case cls_rgw_reshard_status::NOT_RESHARDING: return "not-resharding"; + case cls_rgw_reshard_status::IN_LOGRECORD: + return "in-logrecord"; case cls_rgw_reshard_status::IN_PROGRESS: return "in-progress"; case cls_rgw_reshard_status::DONE: @@ -780,6 +783,10 @@ struct cls_rgw_bucket_instance_entry { return reshard_status != RESHARD_STATUS::NOT_RESHARDING; } + bool resharding_in_logrecord() const { + return reshard_status == RESHARD_STATUS::IN_LOGRECORD; + } + bool resharding_in_progress() const { return reshard_status == RESHARD_STATUS::IN_PROGRESS; } @@ -848,9 +855,15 @@ struct rgw_bucket_dir_header { bool resharding() const { return new_instance.resharding(); } + + bool resharding_in_logrecord() const { + return new_instance.resharding_in_logrecord(); + } + bool resharding_in_progress() const { return new_instance.resharding_in_progress(); } + }; WRITE_CLASS_ENCODER(rgw_bucket_dir_header) diff --git a/src/rgw/driver/rados/rgw_bucket.cc b/src/rgw/driver/rados/rgw_bucket.cc index 996de5f3c4d..572c24162e7 100644 --- a/src/rgw/driver/rados/rgw_bucket.cc +++ b/src/rgw/driver/rados/rgw_bucket.cc @@ -1514,6 +1514,7 @@ static int bucket_stats(rgw::sal::Driver* driver, } } + formatter->dump_int("read_tracker", bucket_info.objv_tracker.read_version.ver); // TODO: bucket CORS // TODO: bucket LC formatter->close_section(); diff --git a/src/rgw/rgw_common.cc b/src/rgw/rgw_common.cc index 987475bf390..433c6f4f8fc 100644 --- a/src/rgw/rgw_common.cc +++ b/src/rgw/rgw_common.cc @@ -2564,7 +2564,6 @@ void RGWBucketInfo::decode_json(JSONObj *obj) { int rs; JSONDecoder::decode_json("reshard_status", rs, obj); reshard_status = (cls_rgw_reshard_status)rs; - rgw_sync_policy_info sp; JSONDecoder::decode_json("sync_policy", sp, obj); if (!sp.empty()) { -- 2.39.5