rgw: dynamic resharding modifies existing bucket instance#35175
rgw: dynamic resharding modifies existing bucket instance#35175smanjara wants to merge 20 commits intoceph:masterfrom
Conversation
5a7e69f to
12a8a6f
Compare
12a8a6f to
4beeb92
Compare
4beeb92 to
bdf26a8
Compare
798216e to
cd74662
Compare
|
@cbodley, pushed changes addressing most of the comments. Could you please review? |
cd74662 to
9435822
Compare
e6b60da to
a0b49ba
Compare
a0b49ba to
63fef4f
Compare
|
@cbodley addressed some comments in the last three commits. Can you please review them? |
63fef4f to
2b558bf
Compare
| bucket_objects[0] = bucket_oid_base; | ||
| } else { | ||
| char buf[bucket_oid_base.size() + 32]; | ||
| char buf[bucket_oid_base.size() + 64]; |
There was a problem hiding this comment.
Would a std::stringstream work better here? Array of chars + snprintf seems so clunky, especially given that the result will ultimately go into a std::string.
| encode_json("tenant", tenant, f); | ||
| encode_json("bucket_name", bucket_name, f); | ||
| encode_json("bucket_id", bucket_id, f); | ||
| encode_json("new_instance_id", new_instance_id, f); |
There was a problem hiding this comment.
Do we need to preserve a backward compatibility here?
src/cls/rgw/cls_rgw_types.cc
Outdated
| { | ||
| encode_json("reshard_status", to_string(reshard_status), f); | ||
| encode_json("new_bucket_instance_id", new_bucket_instance_id, f); | ||
| encode_json("bucket_instance_id", bucket_instance_id, f); |
There was a problem hiding this comment.
Same question about backward compatibility here.
src/rgw/rgw_common.h
Outdated
| cls_rgw_reshard_status reshard_status{cls_rgw_reshard_status::NOT_RESHARDING}; | ||
| string new_bucket_instance_id; | ||
| rgw::BucketReshardState reshard_status{rgw::BucketReshardState::NOT_RESHARDING}; | ||
| string bucket_instance_id; |
There was a problem hiding this comment.
| string bucket_instance_id; | |
| std::string bucket_instance_id; |
nit: let's not rely on namespace inclusion in headers.
src/rgw/rgw_json_enc.cc
Outdated
| encode_json("mdsearch_config", mdsearch_config, f); | ||
| encode_json("reshard_status", (int)reshard_status, f); | ||
| encode_json("new_bucket_instance_id", new_bucket_instance_id, f); | ||
| encode_json("bucket_instance_id", bucket_instance_id, f); |
There was a problem hiding this comment.
Backward compatibility? Do we need to worry about that when working with JSONs?
src/rgw/rgw_admin.cc
Outdated
| int shard_id = (bucket_info.layout.current_index.layout.normal.num_shards > 0 ? i : -1); | ||
| const auto& current = bucket_info.layout.current_index; | ||
| int ret = bs.init(bucket, shard_id, current, nullptr /* no RGWBucketInfo */); | ||
| int ret = bs.init(bucket, shard_id, current, std::nullopt, nullptr /* no RGWBucketInfo */); |
There was a problem hiding this comment.
Is this commit a fixup?
7829051 to
e58da6f
Compare
3881d0a to
b6c85f1
Compare
Thanks, I have fixed it. |
Signed-off-by: Shilpa Jagannath <smanjara@redhat.com>
Signed-off-by: Shilpa Jagannath <smanjara@redhat.com>
…s a parameter. Signed-off-by: Shilpa Jagannath <smanjara@redhat.com>
…tions.
- call init_index() on target layout during reshard process.
Takes const rgw::bucket_index_layout_generation&
Signed-off-by: Shilpa Jagannath <smanjara@redhat.com>
- fix bi_get() to get objects after being resharded Signed-off-by: Shilpa Jagannath <smanjara@redhat.com>
Signed-off-by: Shilpa Jagannath <smanjara@redhat.com>
Signed-off-by: Shilpa Jagannath <smanjara@redhat.com>
Signed-off-by: Shilpa Jagannath <smanjara@redhat.com>
Signed-off-by: Shilpa Jagannath <smanjara@redhat.com>
Signed-off-by: Shilpa Jagannath <smanjara@redhat.com>
…stance_id and new_instance_id fields back for proper decoding. Signed-off-by: Shilpa Jagannath <smanjara@redhat.com>
Signed-off-by: Shilpa Jagannath <smanjara@redhat.com>
- function update_bucket() handles updating bucket state Signed-off-by: Shilpa Jagannath <smanjara@redhat.com>
5b4fdb0 to
5517551
Compare
|
@smanjara have you managed to integrate the FaultInjector stuff for testing? i'd really like to see test cases using that as part of this work |
@cbodley I was under the impression that it was supposed to be used for local testing. Will write some test cases. Thanks! |
|
thanks @smanjara! i think this automated test coverage is important, first to give us confidence that we got things right, and second for regression testing to make sure we don't break things. to recap, i'd like to see two tests cases around each step of the reshard process (one injecting an error, and another injecting a crash), showing we can recover from each - meaning we can both write a new object, and reshard successfully cc @ivancich, since you did a lot of work on the recovery and error handling here, i could really use your help with review! |
Signed-off-by: Casey Bodley <cbodley@redhat.com>
1cc6d45 to
4305ea7
Compare
Signed-off-by: Shilpa Jagannath <smanjara@redhat.com>
4305ea7 to
ae18662
Compare
|
@cbodley Initial results from a single run (search for --inject): After a crash, the reshard lock is held on the bucket for a default time of 360 seconds. Is that intentional? @ivancich can you weigh in? |
|
Reduced the default reshard lock value and re-ran the test |
|
Updated test with more injection points: |
|
This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved |
With these changes dynamic resharding does not require a new bucket instance anymore, thus facilitating the upcoming multisite support use case.
In continuation with #34096 and #34352, a property called bucket layout is introduced in RGWBucketInfo. With every reshard process, the bucket index transitions from current_index to target_index layout and each can have its own properties like BucketIndexType and BucketHashType. To do this, it maintains a generation number that is incremented in every reshard cycle.
This PR is part of multisite work documented in:
https://github.com/ceph/ceph/blob/master/src/doc/rgw/multisite-reshard.md#bucket-index-resharding