Skip to content

rgw: dynamic resharding modifies existing bucket instance - #35175

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

smanjara wants to merge 20 commits into
ceph:masterfrom
smanjara:wip-dynamic-reshard

Conversation

@smanjara

Copy link
Copy Markdown
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
Comment thread src/cls/rgw/cls_rgw_types.h Resolved
Comment thread src/cls/rgw/cls_rgw_types.h Resolved
@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
Comment thread src/rgw/rgw_common.h Resolved
Comment thread src/rgw/rgw_bucket_layout.h Resolved
Comment thread src/rgw/services/svc_bi_rados.cc Resolved
Comment thread src/rgw/services/svc_bi_rados.cc Resolved
@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

smanjara commented Jul 7, 2020

Copy link
Copy Markdown
Contributor Author

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

Comment thread src/cls/rgw/cls_rgw_types.h Resolved
Comment thread src/rgw/rgw_rados.h Resolved
Comment thread src/rgw/rgw_rados.h Resolved
Comment thread src/rgw/services/svc_bi_rados.h Resolved
Comment thread src/rgw/rgw_reshard.cc Resolved
Comment thread src/rgw/rgw_reshard.cc Resolved
Comment thread src/rgw/rgw_reshard.cc Resolved
Comment thread src/rgw/rgw_reshard.cc Resolved
Comment thread src/rgw/rgw_reshard.cc Resolved
Comment thread src/rgw/services/svc_bi_rados.h Resolved
@smanjara
smanjara force-pushed the wip-dynamic-reshard branch from cd74662 to 9435822 Compare July 10, 2020 08:16
Comment thread src/rgw/services/svc_bi_rados.cc Resolved
Comment thread src/rgw/rgw_reshard.cc Resolved
Comment thread src/rgw/rgw_reshard.cc Resolved
Comment thread src/rgw/rgw_reshard.cc Resolved
Comment thread src/rgw/rgw_reshard.cc Resolved
Comment thread src/rgw/rgw_reshard.cc Resolved
Comment thread src/rgw/rgw_reshard.cc Resolved
@smanjara
smanjara force-pushed the wip-dynamic-reshard branch from a0b49ba to 63fef4f Compare July 21, 2020 13:16
@smanjara

ghost commented Jul 23, 2020

Copy link
Copy Markdown
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

ghost left a comment

Copy link
Copy Markdown
Member

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.

Comment thread src/cls/rgw/cls_rgw_types.h Resolved
Comment thread src/cls/rgw/cls_rgw_types.h Resolved
Comment thread src/cls/rgw/cls_rgw_types.h Resolved
Comment thread src/rgw/rgw_admin.cc Resolved
bucket_objects[0] = bucket_oid_base;
} else {
char buf[bucket_oid_base.size() + 32];
char buf[bucket_oid_base.size() + 64];

ghost Aug 25, 2020

Copy link
Copy Markdown
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.

Comment thread src/rgw/rgw_reshard.cc Resolved
Comment thread src/rgw/rgw_reshard.cc Resolved
Comment thread src/rgw/rgw_reshard.cc Resolved
Comment thread src/rgw/rgw_reshard.cc Resolved
Comment thread src/rgw/rgw_rados.cc Resolved
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);

ghost Aug 26, 2020

Copy link
Copy Markdown
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?

Comment thread 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);

ghost Aug 26, 2020

Copy link
Copy Markdown
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.

Comment thread src/cls/rgw/cls_rgw_types.h Resolved
Comment thread 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;

ghost Aug 26, 2020

Copy link
Copy Markdown
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.

Comment thread 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);

ghost Aug 26, 2020

Copy link
Copy Markdown
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?

Comment thread src/rgw/rgw_rados.cc Resolved
Comment thread src/rgw/rgw_reshard.cc Resolved
Comment thread src/rgw/rgw_reshard.cc Resolved
Comment thread src/rgw/services/svc_bi_rados.cc Resolved
Comment thread 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 */);

ghost Aug 27, 2020

Copy link
Copy Markdown
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

ghost commented Sep 21, 2020

Copy link
Copy Markdown
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 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 <[email protected]>
     - fix bi_get() to get objects after being resharded

Signed-off-by: Shilpa Jagannath <[email protected]>
Signed-off-by: Shilpa Jagannath <[email protected]>
…stance_id and

new_instance_id fields back for proper decoding.

Signed-off-by: Shilpa Jagannath <[email protected]>
     - function update_bucket() handles updating bucket state

Signed-off-by: Shilpa Jagannath <[email protected]>
@cbodley

ghost commented Oct 6, 2020

Copy link
Copy Markdown
Contributor

@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

ghost commented Oct 6, 2020

Copy link
Copy Markdown
Contributor Author

@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

ghost commented Oct 6, 2020

Copy link
Copy Markdown
Contributor

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

ghost commented Oct 6, 2020

Copy link
Copy Markdown
Member

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

ghost commented Oct 7, 2020

Copy link
Copy Markdown
Contributor Author

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

Comment thread src/rgw/rgw_reshard.cc Resolved
Comment thread src/rgw/rgw_reshard.cc Resolved
Comment thread src/rgw/rgw_admin.cc Resolved
Comment thread src/rgw/rgw_reshard.cc Resolved
@smanjara
smanjara force-pushed the wip-dynamic-reshard branch from 1cc6d45 to 4305ea7 Compare October 20, 2020 08:28
@smanjara
smanjara force-pushed the wip-dynamic-reshard branch from 4305ea7 to ae18662 Compare October 20, 2020 08:39
@smanjara

ghost commented Oct 28, 2020

Copy link
Copy Markdown
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

ghost commented Nov 2, 2020

Copy link
Copy Markdown
Contributor Author

@github-actions

ghost commented Dec 16, 2020

Copy link
Copy Markdown

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