Skip to content

rgw: dynamic resharding modifies existing bucket instance#35175

Closed
smanjara wants to merge 20 commits intoceph:masterfrom
smanjara:wip-dynamic-reshard
Closed

rgw: dynamic resharding modifies existing bucket instance#35175
smanjara wants to merge 20 commits intoceph:masterfrom
smanjara:wip-dynamic-reshard

Conversation

@smanjara
Copy link
Contributor

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

@smanjara smanjara requested review from cbodley and mattbenjamin May 21, 2020 14:10
@smanjara smanjara force-pushed the wip-dynamic-reshard branch from 5a7e69f to 12a8a6f Compare May 22, 2020 13:13
@neha-ojha neha-ojha added the rgw label May 22, 2020
@smanjara smanjara force-pushed the wip-dynamic-reshard branch from 12a8a6f to 4beeb92 Compare June 10, 2020 14:26
@smanjara smanjara force-pushed the wip-dynamic-reshard branch from 4beeb92 to bdf26a8 Compare June 29, 2020 19:20
@smanjara smanjara force-pushed the wip-dynamic-reshard branch from 798216e to cd74662 Compare July 7, 2020 10:21
@smanjara
Copy link
Contributor Author

smanjara commented Jul 7, 2020

@cbodley, pushed changes addressing most of the comments. Could you please review?

@smanjara smanjara force-pushed the wip-dynamic-reshard branch from cd74662 to 9435822 Compare July 10, 2020 08:16
@smanjara smanjara force-pushed the wip-dynamic-reshard branch from a0b49ba to 63fef4f Compare July 21, 2020 13:16
@smanjara
Copy link
Contributor Author

@cbodley addressed some comments in the last three commits. Can you please review them?

@smanjara smanjara requested a review from ivancich August 20, 2020 07:24
@smanjara smanjara force-pushed the wip-dynamic-reshard branch from 63fef4f to 2b558bf Compare August 25, 2020 06:25
Copy link
Member

@ivancich ivancich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe there are some left-over comments near line #1117 of rgw_common.h.

bucket_objects[0] = bucket_oid_base;
} else {
char buf[bucket_oid_base.size() + 32];
char buf[bucket_oid_base.size() + 64];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to preserve a backward compatibility here?

{
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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same question about backward compatibility here.

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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
string bucket_instance_id;
std::string bucket_instance_id;

nit: let's not rely on namespace inclusion in headers.

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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Backward compatibility? Do we need to worry about that when working with JSONs?

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 */);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this commit a fixup?

@smanjara smanjara force-pushed the wip-dynamic-reshard branch 2 times, most recently from 7829051 to e58da6f Compare September 1, 2020 19:02
@smanjara smanjara force-pushed the wip-dynamic-reshard branch 2 times, most recently from 3881d0a to b6c85f1 Compare September 11, 2020 16:38
@smanjara
Copy link
Contributor Author

I believe there are some left-over comments near line #1117 of rgw_common.h.

Thanks, I have fixed it.

Shilpa Jagannath added 3 commits September 28, 2020 08:13
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>
Shilpa Jagannath added 10 commits September 28, 2020 08:26
…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>
@cbodley
Copy link
Contributor

cbodley commented Oct 6, 2020

@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

@smanjara
Copy link
Contributor Author

smanjara commented Oct 6, 2020

@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!

@cbodley
Copy link
Contributor

cbodley commented Oct 6, 2020

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!

@ivancich
Copy link
Member

ivancich commented Oct 6, 2020

cc @ivancich, since you did a lot of work on the recovery and error handling here, i could really use your help with review!

Sure, @cbodley. I'll spend some time digging in.

@smanjara
Copy link
Contributor Author

smanjara commented Oct 7, 2020

cc @ivancich, since you did a lot of work on the recovery and error handling here, i could really use your help with review!

Sure, @cbodley. I'll spend some time digging in.

That'd be great. Thanks @ivancich

Signed-off-by: Casey Bodley <cbodley@redhat.com>
@smanjara smanjara force-pushed the wip-dynamic-reshard branch from 1cc6d45 to 4305ea7 Compare October 20, 2020 08:28
Signed-off-by: Shilpa Jagannath <smanjara@redhat.com>
@smanjara smanjara force-pushed the wip-dynamic-reshard branch from 4305ea7 to ae18662 Compare October 20, 2020 08:39
@smanjara
Copy link
Contributor Author

@cbodley Initial results from a single run (search for --inject):
http://qa-proxy.ceph.com/teuthology/smanjara-2020-10-28_13:34:20-rgw:verify-wip-dynamic-reshard-distro-basic-smithi/5568240/teuthology.log

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?

@smanjara
Copy link
Contributor Author

smanjara commented Nov 2, 2020

@smanjara
Copy link
Contributor Author

@github-actions
Copy link

This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants