From: Casey Bodley Date: Tue, 6 Oct 2020 21:59:34 +0000 (-0400) Subject: rgw: add rgw_read_bucket_full_sync_status() X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=8a76dda4e210f2dba7edb2235a02e8506da05cab;p=ceph.git rgw: add rgw_read_bucket_full_sync_status() Signed-off-by: Casey Bodley --- diff --git a/src/rgw/rgw_data_sync.cc b/src/rgw/rgw_data_sync.cc index 7a1dd8a62008e..287b531e747b1 100644 --- a/src/rgw/rgw_data_sync.cc +++ b/src/rgw/rgw_data_sync.cc @@ -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, diff --git a/src/rgw/rgw_data_sync.h b/src/rgw/rgw_data_sync.h index 27885783533f2..0a74430ec2597 100644 --- a/src/rgw/rgw_data_sync.h +++ b/src/rgw/rgw_data_sync.h @@ -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,