From edadb6b578ce5100a300d29359aee51701abeeb9 Mon Sep 17 00:00:00 2001 From: Casey Bodley Date: Thu, 19 Aug 2021 16:30:49 -0400 Subject: [PATCH] rgw: resize status vector before reading inc_sync_status rgw_read_bucket_inc_sync_status() uses the size of this vector as the 'num_shards', so we need to resize it appropriately beforehand Signed-off-by: Casey Bodley --- src/rgw/rgw_admin.cc | 1 + src/rgw/rgw_rest_log.cc | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/rgw/rgw_admin.cc b/src/rgw/rgw_admin.cc index c1fe74600cc0f..9161355b78f5f 100644 --- a/src/rgw/rgw_admin.cc +++ b/src/rgw/rgw_admin.cc @@ -2324,6 +2324,7 @@ static int bucket_source_sync_status(const DoutPrefixProvider *dpp, rgw::sal::Ra } std::vector status; + status.resize(full_status.shards_done_with_gen.size()); r = rgw_read_bucket_inc_sync_status(dpp, store, pipe, bucket_info, &source_bucket->get_info(), full_status.incremental_gen, &status); if (r < 0) { lderr(store->ctx()) << "failed to read bucket incremental sync status: " << cpp_strerror(r) << dendl; diff --git a/src/rgw/rgw_rest_log.cc b/src/rgw/rgw_rest_log.cc index 41013df4e4298..a2e795e31a241 100644 --- a/src/rgw/rgw_rest_log.cc +++ b/src/rgw/rgw_rest_log.cc @@ -1006,6 +1006,7 @@ void RGWOp_BILog_Status::execute(optional_yield y) ldpp_dout(this, -1) << "ERROR: rgw_read_bucket_full_sync_status() on pipe=" << pipe << " returned ret=" << op_ret << dendl; return; } + status.inc_status.resize(status.sync_status.shards_done_with_gen.size()); op_ret = rgw_read_bucket_inc_sync_status( this, @@ -1073,6 +1074,7 @@ void RGWOp_BILog_Status::execute(optional_yield y) return; } + current_status.resize(status.sync_status.shards_done_with_gen.size()); int r = rgw_read_bucket_inc_sync_status(this, static_cast(store), pipe, *pinfo, &bucket->get_info(), status.sync_status.incremental_gen, ¤t_status); if (r < 0) { -- 2.39.5