From: Casey Bodley Date: Thu, 25 Apr 2019 13:57:33 +0000 (-0400) Subject: rgw: bilog trim uses bucket_info.num_shards to size marker array X-Git-Tag: v14.2.5~110^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=8527188e83be99bdf54bf5e7dcccc4ac613187bc;p=ceph.git rgw: bilog trim uses bucket_info.num_shards to size marker array Signed-off-by: Casey Bodley (cherry picked from commit af7801fc8832ec400b92706a8caef2aeac09e638) --- diff --git a/src/rgw/rgw_sync_log_trim.cc b/src/rgw/rgw_sync_log_trim.cc index 686d21e80a6..243fa65d0f6 100644 --- a/src/rgw/rgw_sync_log_trim.cc +++ b/src/rgw/rgw_sync_log_trim.cc @@ -353,14 +353,8 @@ template int take_min_status(CephContext *cct, Iter first, Iter last, std::vector *status) { - status->clear(); - std::optional 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);