]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: resize status vector before reading inc_sync_status
authorCasey Bodley <cbodley@redhat.com>
Thu, 19 Aug 2021 20:30:49 +0000 (16:30 -0400)
committerAdam C. Emerson <aemerson@redhat.com>
Tue, 1 Feb 2022 22:36:17 +0000 (17:36 -0500)
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 <cbodley@redhat.com>
src/rgw/rgw_admin.cc
src/rgw/rgw_rest_log.cc

index 6443ef4c4d64e2d6ca8666331af7087a2cfcb6dc..72e2d3fea50da57819e997322aca082af9295ac0 100644 (file)
@@ -2537,6 +2537,7 @@ static int bucket_source_sync_status(const DoutPrefixProvider *dpp, rgw::sal::Ra
   }
 
   std::vector<rgw_bucket_shard_sync_info> 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;
index 985319271505d4c3acb52015e1ba16c67c7ea397..f138c9e77b5253ee4892cc53de8700d3cc42b67a 100644 (file)
@@ -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<rgw::sal::RadosStore*>(store),
                                            pipe, *pinfo, &bucket->get_info(), status.sync_status.incremental_gen, &current_status);
     if (r < 0) {