]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: fix handling of bucket layout in metadata sync
authorCasey Bodley <cbodley@redhat.com>
Fri, 14 May 2021 16:30:21 +0000 (12:30 -0400)
committerCasey Bodley <cbodley@redhat.com>
Fri, 27 May 2022 19:47:32 +0000 (15:47 -0400)
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 <cbodley@redhat.com>
src/rgw/rgw_bucket.cc

index 329e5e358245862758525242fcd6f5361912183e..7405d0919adbc229bfd5b8acff74b3ff5ebcce2e 100644 (file)
@@ -2314,12 +2314,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;
     }