From bf020a76282e853d5f6e2c59db520dae1fb562ef Mon Sep 17 00:00:00 2001 From: Casey Bodley Date: Fri, 14 May 2021 12:30:21 -0400 Subject: [PATCH] rgw: fix handling of bucket layout in metadata sync clear the bucket layout we get from the metadata master, and overwrite it with our zone's defaults without clearing the layout, init_default_bucket_layout() was adding another log layout in addition to the one from the master. this caused the bilog list API to provide a 'next_log' when only gen=0 exists Signed-off-by: Casey Bodley --- src/rgw/rgw_bucket.cc | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/rgw/rgw_bucket.cc b/src/rgw/rgw_bucket.cc index 2da513128c17f..2d98beb70173a 100644 --- a/src/rgw/rgw_bucket.cc +++ b/src/rgw/rgw_bucket.cc @@ -2346,12 +2346,11 @@ int RGWMetadataHandlerPut_BucketInstance::put_check(const DoutPrefixProvider *dp if (from_remote_zone) { // don't sync bucket layout changes if (!exists) { - auto& bci_index = bci.info.layout.current_index.layout; - auto index_type = bci_index.type; - auto num_shards = bci_index.normal.num_shards; + // replace peer's layout with default-constructed, then apply our defaults + bci.info.layout = rgw::BucketLayout{}; init_default_bucket_layout(cct, bci.info.layout, bihandler->svc.zone->get_zone(), - num_shards, index_type); + std::nullopt, std::nullopt); } else { bci.info.layout = old_bci->info.layout; } -- 2.39.5