]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: add rgw_read_bucket_full_sync_status()
authorCasey Bodley <cbodley@redhat.com>
Tue, 6 Oct 2020 21:59:34 +0000 (17:59 -0400)
committerAdam C. Emerson <aemerson@redhat.com>
Mon, 31 Jan 2022 20:23:58 +0000 (15:23 -0500)
Signed-off-by: Casey Bodley <cbodley@redhat.com>
src/rgw/rgw_data_sync.cc
src/rgw/rgw_data_sync.h

index 7a1dd8a62008e2c373ff092545bb11ba15b7e13b..287b531e747b1ea177572671642a3595d8a629bf 100644 (file)
@@ -5358,6 +5358,37 @@ class RGWCollectBucketSyncStatusCR : public RGWShardCollectCR {
   }
 };
 
+int rgw_read_bucket_full_sync_status(const DoutPrefixProvider *dpp,
+                                     rgw::sal::RadosStore *store,
+                                     const rgw_sync_bucket_pipe& pipe,
+                                     rgw_bucket_sync_status *status,
+                                     optional_yield y)
+{
+  auto get_oid = RGWBucketPipeSyncStatusManager::full_status_oid;
+  const rgw_raw_obj obj{store->svc()->zone->get_zone_params().log_pool,
+                        get_oid(*pipe.source.zone, *pipe.source.bucket, *pipe.dest.bucket)};
+
+  auto svc = store->svc()->sysobj;
+  auto obj_ctx = svc->init_obj_ctx();
+  auto sysobj = svc->get_obj(obj_ctx, obj);
+  bufferlist bl;
+  int ret = sysobj.rop().read(dpp, &bl, y);
+  if (ret < 0)
+    return ret;
+
+  try {
+    auto iter = bl.cbegin();
+    using ceph::decode;
+    rgw_bucket_sync_status result;
+    decode(result, iter);
+    *status = result;
+    return 0;
+  } catch (const buffer::error& err) {
+    lderr(svc->ctx()) << "error decoding " << obj << ": " << err.what() << dendl;
+    return -EIO;
+  }
+}
+
 int rgw_read_bucket_inc_sync_status(const DoutPrefixProvider *dpp,
                                     rgw::sal::RadosStore *store,
                                     const rgw_sync_bucket_pipe& pipe,
index 27885783533f2d89632c21471162e64ab4191698..0a74430ec2597b1fdd3d0aeb28c440d132f9e88b 100644 (file)
@@ -742,6 +742,13 @@ public:
   int run(const DoutPrefixProvider *dpp);
 };
 
+/// read the full sync status with respect to a source bucket
+int rgw_read_bucket_full_sync_status(const DoutPrefixProvider *dpp,
+                                     rgw::sal::RadosStore *store,
+                                     const rgw_sync_bucket_pipe& pipe,
+                                     rgw_bucket_sync_status *status,
+                                     optional_yield y);
+
 /// read the incremental sync status of all bucket shards from the given source zone
 int rgw_read_bucket_inc_sync_status(const DoutPrefixProvider *dpp,
                                     rgw::sal::RadosStore *store,