]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: reshard adds a log layout for the new index
authorCasey Bodley <cbodley@redhat.com>
Mon, 1 Feb 2021 17:04:36 +0000 (12:04 -0500)
committerAdam C. Emerson <aemerson@redhat.com>
Tue, 1 Feb 2022 14:59:56 +0000 (09:59 -0500)
Signed-off-by: Casey Bodley <cbodley@redhat.com>
src/rgw/rgw_bucket.cc
src/rgw/rgw_bucket_layout.cc
src/rgw/rgw_bucket_layout.h
src/rgw/rgw_common.cc
src/rgw/rgw_reshard.cc

index d9c736fb985e74b87fce688bc69e1ff4da321806..806c34a08ce0bdc38ccfd9ec9e66702335352d96 100644 (file)
@@ -2324,9 +2324,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));
   }
 }
 
index 85002ba9cb7da909751998f39eed1a29a34f4ca6..22d75d0d30d3d914e4919c171726a737b902e786 100644 (file)
@@ -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);
index b5f0bacb512bff61e795a6a27ae484525811fcb2..09bbd1c142c05e3a1c7d4d60b8da5ca8312d5f55 100644 (file)
@@ -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)
index 9fdebb950e47c05e5dabcd3db3ee6bbf19004e5c..d49193d25dc63d35999e816c5c517e0fce536e27 100644 (file)
@@ -2283,7 +2283,7 @@ void RGWBucketInfo::decode(bufferlist::const_iterator& bl) {
 
   if (layout.logs.empty() &&
       layout.current_index.layout.type == rgw::BucketIndexType::Normal) {
-    layout.logs.push_back(rgw::log_layout_from_index(0, layout.current_index.layout.normal));
+    layout.logs.push_back(rgw::log_layout_from_index(0, layout.current_index));
   }
   DECODE_FINISH(bl);
 }
@@ -2377,7 +2377,7 @@ void RGWBucketInfo::generate_test_instances(list<RGWBucketInfo*>& o)
     l.current_index.layout.normal.num_shards = 11;
     l.logs.push_back(log_layout_from_index(
                        l.current_index.gen,
-                       l.current_index.layout.normal));
+                       l.current_index));
   };
 
 
index cc04673c63d80120ea62e34db8fbd0ab897e69a0..a882c5ef661a0c7870cc74e9fd3eb70ce7b9dac3 100644 (file)
@@ -452,6 +452,9 @@ static int commit_reshard(rgw::sal::RadosStore* 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