]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: rgw_read_bucket_inc_sync_status doesn't need bucket info
authorCasey Bodley <cbodley@redhat.com>
Thu, 19 Aug 2021 20:12:21 +0000 (16:12 -0400)
committerCasey Bodley <cbodley@redhat.com>
Fri, 17 Sep 2021 18:45:08 +0000 (14:45 -0400)
all we need to construct the per-shard bucket sync status object names
are the bucket names themselves, which we already have from
rgw_sync_bucket_pipe

Signed-off-by: Casey Bodley <cbodley@redhat.com>
src/rgw/rgw_admin.cc
src/rgw/rgw_data_sync.cc
src/rgw/rgw_data_sync.h
src/rgw/rgw_rest_log.cc
src/rgw/rgw_sync_checkpoint.cc

index 9161355b78f5f5888cab73ba7bed2de108301882..5901d187296db9c54d07402ebc17dc57fab01904 100644 (file)
@@ -2325,7 +2325,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);
+  r = rgw_read_bucket_inc_sync_status(dpp, store, pipe, full_status.incremental_gen, &status);
   if (r < 0) {
     lderr(store->ctx()) << "failed to read bucket incremental sync status: " << cpp_strerror(r) << dendl;
     return r;
index 5e85a0eebabed2811c1d1405b66d9756b694f91d..4112da06458a7f627bcf81f14283108d3a17373b 100644 (file)
@@ -5719,19 +5719,13 @@ class RGWCollectBucketSyncStatusCR : public RGWShardCollectCR {
   }
  public:
   RGWCollectBucketSyncStatusCR(rgw::sal::RadosStore* store, RGWDataSyncCtx *sc,
-                               const RGWBucketInfo& source_bucket_info,
-                               const RGWBucketInfo& dest_bucket_info,
+                               const rgw_bucket_sync_pair_info& sync_pair,
                                uint64_t gen,
                                Vector *status)
     : RGWShardCollectCR(sc->cct, max_concurrent_shards),
-      store(store), sc(sc), env(sc->env), gen(gen),
+      store(store), sc(sc), env(sc->env), gen(gen), sync_pair(sync_pair),
       i(status->begin()), end(status->end())
-  {
-    // This function doesn't need to know the remote shard count, but
-    // callers of read_bucket_inc_sync_status do
-    sync_pair.source_bs = rgw_bucket_shard(source_bucket_info.bucket, 0);
-    sync_pair.dest_bucket = dest_bucket_info.bucket;
-  }
+  {}
 
   bool spawn_next() override {
     if (i == end) {
@@ -5778,8 +5772,6 @@ int rgw_read_bucket_full_sync_status(const DoutPrefixProvider *dpp,
 int rgw_read_bucket_inc_sync_status(const DoutPrefixProvider *dpp,
                                     rgw::sal::RadosStore *store,
                                     const rgw_sync_bucket_pipe& pipe,
-                                    const RGWBucketInfo& dest_bucket_info,
-                                    const RGWBucketInfo *psource_bucket_info,
                                     uint64_t gen,
                                     std::vector<rgw_bucket_shard_sync_info> *status)
 {
@@ -5790,27 +5782,10 @@ int rgw_read_bucket_inc_sync_status(const DoutPrefixProvider *dpp,
     return -EINVAL;
   }
 
-  if (*pipe.dest.bucket !=
-      dest_bucket_info.bucket) {
-    return -EINVAL;
-  }
-
-  const rgw_bucket& source_bucket = *pipe.source.bucket;
-
-  RGWBucketInfo source_bucket_info;
-
-  if (!psource_bucket_info) {
-    auto& bucket_ctl = store->getRados()->ctl.bucket;
-
-    int ret = bucket_ctl->read_bucket_info(source_bucket, &source_bucket_info, null_yield, dpp);
-    if (ret < 0) {
-      ldpp_dout(dpp, 0) << "ERROR: failed to get bucket instance info: bucket=" << source_bucket << ": " << cpp_strerror(-ret) << dendl;
-      return ret;
-    }
-
-    psource_bucket_info = &source_bucket_info;
-  }
-
+  rgw_bucket_sync_pair_info sync_pair;
+  sync_pair.source_bs.bucket = *pipe.source.bucket;
+  sync_pair.source_bs.shard_id = 0;
+  sync_pair.dest_bucket = *pipe.dest.bucket;
 
   RGWDataSyncEnv env;
   RGWSyncModuleInstanceRef module; // null sync module
@@ -5822,8 +5797,7 @@ int rgw_read_bucket_inc_sync_status(const DoutPrefixProvider *dpp,
 
   RGWCoroutinesManager crs(store->ctx(), store->getRados()->get_cr_registry());
   return crs.run(dpp, new RGWCollectBucketSyncStatusCR(store, &sc,
-                                                  *psource_bucket_info,
-                                                  dest_bucket_info,
+                                                  sync_pair,
                                                   gen,
                                                   status));
 }
index 88c0db42f605df72805e618f800d562de48b20d4..bc0063e9e0fe1c7190002a6b3c8c56fd718fdca6 100644 (file)
@@ -779,8 +779,6 @@ int rgw_read_bucket_full_sync_status(const DoutPrefixProvider *dpp,
 int rgw_read_bucket_inc_sync_status(const DoutPrefixProvider *dpp,
                                     rgw::sal::RadosStore *store,
                                     const rgw_sync_bucket_pipe& pipe,
-                                    const RGWBucketInfo& dest_bucket_info,
-                                    const RGWBucketInfo *psource_bucket_info,
                                     uint64_t gen,
                                     std::vector<rgw_bucket_shard_sync_info> *status);
 
index a2e795e31a2419376591e9ca843cf26167393e0a..8711ef05fc6d687ed4a14da3c95f60c1f36d3bef 100644 (file)
@@ -1012,8 +1012,6 @@ void RGWOp_BILog_Status::execute(optional_yield y)
       this,
       static_cast<rgw::sal::RadosStore*>(store),
       pipe,
-      bucket->get_info(),
-      nullptr,
       status.sync_status.incremental_gen,
       &status.inc_status);
     if (op_ret < 0) {
@@ -1076,7 +1074,7 @@ void RGWOp_BILog_Status::execute(optional_yield y)
 
     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);
+                                           pipe, status.sync_status.incremental_gen, &current_status);
     if (r < 0) {
       ldpp_dout(this, -1) << "ERROR: rgw_read_bucket_inc_sync_status() on pipe=" << pipe << " returned ret=" << r << dendl;
       op_ret = r;
index 94f09d0fe4782ecd442fc16c5768584c4e824f5f..dcbc1b156b7d3bd6f42ea5b4830df678156f7e01 100644 (file)
@@ -144,8 +144,8 @@ int bucket_source_sync_checkpoint(const DoutPrefixProvider* dpp,
 
   std::vector<rgw_bucket_shard_sync_info> status;
   status.resize(std::max<size_t>(1, num_shards));
-  r = rgw_read_bucket_inc_sync_status(dpp, store, pipe, bucket_info,
-                                      &source_bucket_info, full_status.incremental_gen, &status);
+  r = rgw_read_bucket_inc_sync_status(dpp, store, pipe,
+                                      full_status.incremental_gen, &status);
   if (r < 0) {
     return r;
   }
@@ -160,8 +160,8 @@ int bucket_source_sync_checkpoint(const DoutPrefixProvider* dpp,
         << "      local status: " << status << '\n'
         << "    remote markers: " << remote_markers << dendl;
     std::this_thread::sleep_until(delay_until);
-    r = rgw_read_bucket_inc_sync_status(dpp, store, pipe, bucket_info,
-                                        &source_bucket_info, full_status.incremental_gen, &status);
+    r = rgw_read_bucket_inc_sync_status(dpp, store, pipe,
+                                        full_status.incremental_gen, &status);
     if (r < 0) {
       return r;
     }