From ed250cc963ef5312bfa2b5cbb066d0b1b4ba7fa5 Mon Sep 17 00:00:00 2001 From: Casey Bodley Date: Mon, 1 Feb 2021 12:04:36 -0500 Subject: [PATCH] rgw: reshard adds a log layout for the new index Signed-off-by: Casey Bodley --- src/rgw/rgw_bucket.cc | 4 +--- src/rgw/rgw_bucket_layout.cc | 4 +--- src/rgw/rgw_bucket_layout.h | 4 ++-- src/rgw/rgw_reshard.cc | 3 +++ 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/rgw/rgw_bucket.cc b/src/rgw/rgw_bucket.cc index 356823e59386e..e76d0cd0f6bd7 100644 --- a/src/rgw/rgw_bucket.cc +++ b/src/rgw/rgw_bucket.cc @@ -2592,9 +2592,7 @@ void init_default_bucket_layout(CephContext *cct, rgw::BucketLayout& layout, } if (layout.current_index.layout.type == rgw::BucketIndexType::Normal) { - layout.logs.push_back(log_layout_from_index( - layout.current_index.gen, - layout.current_index.layout.normal)); + layout.logs.push_back(log_layout_from_index(0, layout.current_index)); } } diff --git a/src/rgw/rgw_bucket_layout.cc b/src/rgw/rgw_bucket_layout.cc index 85002ba9cb7da..22d75d0d30d3d 100644 --- a/src/rgw/rgw_bucket_layout.cc +++ b/src/rgw/rgw_bucket_layout.cc @@ -146,9 +146,7 @@ void decode(BucketLayout& l, bufferlist::const_iterator& bl) l.logs.clear(); // initialize the log layout to match the current index layout if (l.current_index.layout.type == BucketIndexType::Normal) { - const auto gen = l.current_index.gen; - const auto& index = l.current_index.layout.normal; - l.logs.push_back(log_layout_from_index(gen, index)); + l.logs.push_back(log_layout_from_index(0, l.current_index)); } } else { decode(l.logs, bl); diff --git a/src/rgw/rgw_bucket_layout.h b/src/rgw/rgw_bucket_layout.h index b5f0bacb512bf..09bbd1c142c05 100644 --- a/src/rgw/rgw_bucket_layout.h +++ b/src/rgw/rgw_bucket_layout.h @@ -115,9 +115,9 @@ void decode(bucket_log_layout_generation& l, bufferlist::const_iterator& bl); // return a log layout that shares its layout with the index inline bucket_log_layout_generation log_layout_from_index( - uint64_t gen, const bucket_index_normal_layout& index) + uint64_t gen, const bucket_index_layout_generation& index) { - return {gen, {BucketLogType::InIndex, {gen, index}}}; + return {gen, {BucketLogType::InIndex, {index.gen, index.layout.normal}}}; } inline auto matches_gen(uint64_t gen) diff --git a/src/rgw/rgw_reshard.cc b/src/rgw/rgw_reshard.cc index ee591163c1070..6b313fa3ddda5 100644 --- a/src/rgw/rgw_reshard.cc +++ b/src/rgw/rgw_reshard.cc @@ -447,6 +447,9 @@ static int commit_reshard(rgw::sal::RGWRadosStore* store, layout.current_index = std::move(*layout.target_index); layout.target_index = std::nullopt; layout.resharding = rgw::BucketReshardState::None; + // add the in-index log layout + const auto next_log_gen = layout.logs.back().gen + 1; + layout.logs.push_back(log_layout_from_index(next_log_gen, layout.current_index)); int ret = fault.check("commit_target_layout"); if (ret == 0) { // no fault injected, write the bucket instance metadata -- 2.39.5