]> git.apps.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)
committerAdam C. Emerson <aemerson@redhat.com>
Mon, 13 Sep 2021 16:27:50 +0000 (12:27 -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 f6c0a280c0e25eece2013288d1cc30cf3d1bb594..30166c7820af2d5a04762a665ebb53f4f18ba5b8 100644 (file)
@@ -2322,12 +2322,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;
     }