diff options
author | liangmingyuan <liangmingyuan@baidu.com> | 2024-03-22 02:13:09 +0100 |
---|---|---|
committer | liangmingyuan <liangmingyuan@baidu.com> | 2024-07-22 03:19:25 +0200 |
commit | 5e7de76407c6f782f1aa5e53376669bbe4689ade (patch) | |
tree | e8a859417c34c84710016dfbf9fe633386f918b4 /src/rgw/services | |
parent | rgw/reshard: stop recording logs when reshard failed (diff) | |
download | ceph-5e7de76407c6f782f1aa5e53376669bbe4689ade.tar.xz ceph-5e7de76407c6f782f1aa5e53376669bbe4689ade.zip |
rgw/reshard: Backward Compatibility
The privious release only has one reshard phase: the progress phase
which will block client writes. Because our release contains this
phase and the process is same too, that means it is superset of
privious release. So when privious rgw initiates a reshard, it will
execute as before.
When a updated rgw initiates a reshard, it firstly enter the
logrecord phase which privious releases do not realized. That means
the nodes which do not upgraded will deal with client write
operations without recording logs. It may leads to part of these
index entries missed. So we forbit this scene by adding
`cls_rgw_set_bucket_resharding2()` and `cls_rgw_bucket_init_index2()`
control source and target versions, old osds would fail the request
with -EOPNOTSUPP. so radosgw could start by trying that on all
shards. if there are no errors, it can safely proceed with the new
scheme. If any of the osds do return -EOPNOTSUPP there, then rgw
fall back to the current resharding scheme where writes are blocked
the whole time.
Signed-off-by: Mingyuan Liang <liangmingyuan@baidu.com>
Diffstat (limited to 'src/rgw/services')
-rw-r--r-- | src/rgw/services/svc_bi.h | 9 | ||||
-rw-r--r-- | src/rgw/services/svc_bi_rados.cc | 17 | ||||
-rw-r--r-- | src/rgw/services/svc_bi_rados.h | 9 |
3 files changed, 27 insertions, 8 deletions
diff --git a/src/rgw/services/svc_bi.h b/src/rgw/services/svc_bi.h index bd811e1623a..901c28d59fd 100644 --- a/src/rgw/services/svc_bi.h +++ b/src/rgw/services/svc_bi.h @@ -29,8 +29,13 @@ public: RGWSI_BucketIndex(CephContext *cct) : RGWServiceInstance(cct) {} virtual ~RGWSI_BucketIndex() {} - virtual int init_index(const DoutPrefixProvider *dpp, RGWBucketInfo& bucket_info, const rgw::bucket_index_layout_generation& idx_layout) = 0; - virtual int clean_index(const DoutPrefixProvider *dpp, RGWBucketInfo& bucket_info, const rgw::bucket_index_layout_generation& idx_layout) = 0; + virtual int init_index(const DoutPrefixProvider *dpp, + RGWBucketInfo& bucket_info, + const rgw::bucket_index_layout_generation& idx_layout, + bool judge_support_logrecord = false) = 0; + virtual int clean_index(const DoutPrefixProvider *dpp, + RGWBucketInfo& bucket_info, + const rgw::bucket_index_layout_generation& idx_layout) = 0; virtual int read_stats(const DoutPrefixProvider *dpp, const RGWBucketInfo& bucket_info, diff --git a/src/rgw/services/svc_bi_rados.cc b/src/rgw/services/svc_bi_rados.cc index 20c842c3805..15cd5cd58ed 100644 --- a/src/rgw/services/svc_bi_rados.cc +++ b/src/rgw/services/svc_bi_rados.cc @@ -351,7 +351,10 @@ int RGWSI_BucketIndex_RADOS::cls_bucket_head(const DoutPrefixProvider *dpp, return 0; } -int RGWSI_BucketIndex_RADOS::init_index(const DoutPrefixProvider *dpp,RGWBucketInfo& bucket_info, const rgw::bucket_index_layout_generation& idx_layout) +int RGWSI_BucketIndex_RADOS::init_index(const DoutPrefixProvider *dpp, + RGWBucketInfo& bucket_info, + const rgw::bucket_index_layout_generation& idx_layout, + bool judge_support_logrecord) { librados::IoCtx index_pool; @@ -366,9 +369,15 @@ int RGWSI_BucketIndex_RADOS::init_index(const DoutPrefixProvider *dpp,RGWBucketI map<int, string> bucket_objs; get_bucket_index_objects(dir_oid, idx_layout.layout.normal.num_shards, idx_layout.gen, &bucket_objs); - return CLSRGWIssueBucketIndexInit(index_pool, - bucket_objs, - cct->_conf->rgw_bucket_index_max_aio)(); + if (judge_support_logrecord) { + return CLSRGWIssueBucketIndexInit2(index_pool, + bucket_objs, + cct->_conf->rgw_bucket_index_max_aio)(); + } else { + return CLSRGWIssueBucketIndexInit(index_pool, + bucket_objs, + cct->_conf->rgw_bucket_index_max_aio)(); + } } int RGWSI_BucketIndex_RADOS::clean_index(const DoutPrefixProvider *dpp, RGWBucketInfo& bucket_info, const rgw::bucket_index_layout_generation& idx_layout) diff --git a/src/rgw/services/svc_bi_rados.h b/src/rgw/services/svc_bi_rados.h index c6c11f8bc00..7acf5c08807 100644 --- a/src/rgw/services/svc_bi_rados.h +++ b/src/rgw/services/svc_bi_rados.h @@ -121,8 +121,13 @@ public: return bucket_shard_index(sharding_key, num_shards); } - int init_index(const DoutPrefixProvider *dpp, RGWBucketInfo& bucket_info,const rgw::bucket_index_layout_generation& idx_layout) override; - int clean_index(const DoutPrefixProvider *dpp, RGWBucketInfo& bucket_info, const rgw::bucket_index_layout_generation& idx_layout) override; + int init_index(const DoutPrefixProvider *dpp, + RGWBucketInfo& bucket_info, + const rgw::bucket_index_layout_generation& idx_layout, + bool judge_support_logrecord = false) override; + int clean_index(const DoutPrefixProvider *dpp, + RGWBucketInfo& bucket_info, + const rgw::bucket_index_layout_generation& idx_layout) override; /* RADOS specific */ |