From 9b1f1e1eddb82d00f562ab2072b147748cd846aa Mon Sep 17 00:00:00 2001 From: "Adam C. Emerson" Date: Thu, 30 Jun 2022 14:29:30 -0400 Subject: [PATCH] rgw: Print user friendly progress on `bucket sync init` When `--extra-info` is provided Signed-off-by: Adam C. Emerson --- src/rgw/rgw_data_sync.cc | 35 ++++++++++++++++++++--------------- src/rgw/rgw_data_sync.h | 5 +++++ 2 files changed, 25 insertions(+), 15 deletions(-) diff --git a/src/rgw/rgw_data_sync.cc b/src/rgw/rgw_data_sync.cc index 3c110ebd50c39..ff3fa92ccb8b6 100644 --- a/src/rgw/rgw_data_sync.cc +++ b/src/rgw/rgw_data_sync.cc @@ -5437,28 +5437,33 @@ RGWBucketPipeSyncStatusManager::construct( return self; } -int RGWBucketPipeSyncStatusManager::init_sync_status(const DoutPrefixProvider *dpp) +int RGWBucketPipeSyncStatusManager::init_sync_status( + const DoutPrefixProvider *dpp) { - list stacks; - std::vector full_status_objs; - std::vector full_status; - + // Just running one at a time saves us from buildup/teardown and in + // practice we only do one zone at a time. for (auto& source : sources) { + list stacks; RGWCoroutinesStack *stack = new RGWCoroutinesStack(store->ctx(), &cr_mgr); - full_status_objs.emplace_back( - sync_env.svc->zone->get_zone_params().log_pool, - full_status_oid(source.sc.source_zone, source.info.bucket, source.dest)); - - full_status.emplace_back(); - + pretty_print(source.sc.env, "Initializing sync state of bucket {} with zone {}.\n", + source.info.bucket.name, source.zone_name); stack->call(new RGWSimpleRadosWriteCR( dpp, source.sc.env->async_rados, source.sc.env->svc->sysobj, - full_status_objs.back(), full_status.back())); - + {sync_env.svc->zone->get_zone_params().log_pool, + full_status_oid(source.sc.source_zone, + source.info.bucket, + source.dest)}, + rgw_bucket_sync_status{})); stacks.push_back(stack); + auto r = cr_mgr.run(dpp, stacks); + if (r < 0) { + pretty_print(source.sc.env, + "Initialization of sync state for bucket {} with zone {} " + "failed with error {}\n", + source.info.bucket.name, source.zone_name, cpp_strerror(r)); + } } - - return cr_mgr.run(dpp, stacks); + return 0; } tl::expected, int> diff --git a/src/rgw/rgw_data_sync.h b/src/rgw/rgw_data_sync.h index 35db02f1d729c..3eb809f08f690 100644 --- a/src/rgw/rgw_data_sync.h +++ b/src/rgw/rgw_data_sync.h @@ -4,6 +4,11 @@ #ifndef CEPH_RGW_DATA_SYNC_H #define CEPH_RGW_DATA_SYNC_H +#undef FMT_HEADER_ONLY +#define FMT_HEADER_ONLY 1 +#include +#include + #include "include/encoding.h" #include "common/ceph_json.h" -- 2.39.5