]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: bilog trim uses bucket_info.num_shards to size marker array
authorCasey Bodley <cbodley@redhat.com>
Thu, 25 Apr 2019 13:57:33 +0000 (09:57 -0400)
committerCasey Bodley <cbodley@redhat.com>
Fri, 18 Oct 2019 19:34:11 +0000 (15:34 -0400)
Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit af7801fc8832ec400b92706a8caef2aeac09e638)

src/rgw/rgw_sync_log_trim.cc

index 686d21e80a6ba219fe0b8ff286e1b0f24315f75d..243fa65d0f6a4c27ebf0aba0293b58665a4626e2 100644 (file)
@@ -353,14 +353,8 @@ template <typename Iter>
 int take_min_status(CephContext *cct, Iter first, Iter last,
                     std::vector<std::string> *status)
 {
-  status->clear();
-  std::optional<uint64_t> num_shards;
   for (auto peer = first; peer != last; ++peer) {
-    const size_t peer_shards = peer->size();
-    if (!num_shards) {
-      num_shards = peer_shards;
-      status->resize(*num_shards);
-    } else if (*num_shards != peer_shards) {
+    if (peer->size() != status->size()) {
       // all peers must agree on the number of shards
       return -EINVAL;
     }
@@ -483,6 +477,8 @@ int BucketTrimInstanceCR::operate()
       }
     }
 
+    min_markers.resize(std::max(1u, bucket_info.num_shards));
+
     // determine the minimum marker for each shard
     retcode = take_min_status(cct, peer_status.begin(), peer_status.end(),
                               &min_markers);