From 8fd78a97c207a80555408755e8be304b6baca0d2 Mon Sep 17 00:00:00 2001 From: Casey Bodley Date: Tue, 6 Oct 2020 17:59:18 -0400 Subject: [PATCH] rgw: add full_status_oid() for buckets Signed-off-by: Casey Bodley --- src/rgw/rgw_data_sync.cc | 14 ++++++++++++++ src/rgw/rgw_data_sync.h | 3 +++ 2 files changed, 17 insertions(+) diff --git a/src/rgw/rgw_data_sync.cc b/src/rgw/rgw_data_sync.cc index cd5a7dd4e4807..f58c92af31669 100644 --- a/src/rgw/rgw_data_sync.cc +++ b/src/rgw/rgw_data_sync.cc @@ -49,6 +49,7 @@ using namespace std; static const string datalog_sync_status_oid_prefix = "datalog.sync-status"; static const string datalog_sync_status_shard_prefix = "datalog.sync-status.shard"; static const string datalog_sync_full_sync_index_prefix = "data.full-sync.index"; +static const string bucket_full_status_oid_prefix = "bucket.full-sync-status"; static const string bucket_status_oid_prefix = "bucket.sync-status"; static const string object_status_oid_prefix = "bucket.sync-status"; @@ -4867,6 +4868,19 @@ std::ostream& RGWBucketPipeSyncStatusManager::gen_prefix(std::ostream& out) cons << " bucket:" << dest_bucket << ' '; } +string RGWBucketPipeSyncStatusManager::full_status_oid(const rgw_zone_id& source_zone, + const rgw_bucket& source_bucket, + const rgw_bucket& dest_bucket) +{ + if (source_bucket == dest_bucket) { + return bucket_full_status_oid_prefix + "." + source_zone.id + ":" + + dest_bucket.get_key(); + } else { + return bucket_full_status_oid_prefix + "." + source_zone.id + ":" + + dest_bucket.get_key() + ":" + source_bucket.get_key(); + } +} + string RGWBucketPipeSyncStatusManager::inc_status_oid(const rgw_zone_id& source_zone, const rgw_bucket_sync_pair_info& sync_pair) { diff --git a/src/rgw/rgw_data_sync.h b/src/rgw/rgw_data_sync.h index b4e371fa83579..2f33a7eb0e548 100644 --- a/src/rgw/rgw_data_sync.h +++ b/src/rgw/rgw_data_sync.h @@ -725,6 +725,9 @@ public: std::map& get_sync_status() { return sync_status; } int init_sync_status(const DoutPrefixProvider *dpp); + static std::string full_status_oid(const rgw_zone_id& source_zone, + const rgw_bucket& source_bucket, + const rgw_bucket& dest_bucket); static std::string inc_status_oid(const rgw_zone_id& source_zone, const rgw_bucket_sync_pair_info& bs); // specific source obj sync status, can be used by sync modules -- 2.39.5