From df723e5fe7898791627f94b81039a53481b97f7d Mon Sep 17 00:00:00 2001 From: Casey Bodley Date: Mon, 27 Aug 2018 19:45:06 -0400 Subject: [PATCH] rgw: RGWBucketSyncStatusManager implements DoutPrefixProvider and passes its pointer to RGWRemoteBucketLog Signed-off-by: Casey Bodley --- src/rgw/rgw_data_sync.cc | 26 +++++++++++++++++++------- src/rgw/rgw_data_sync.h | 19 +++++++++++++++---- 2 files changed, 34 insertions(+), 11 deletions(-) diff --git a/src/rgw/rgw_data_sync.cc b/src/rgw/rgw_data_sync.cc index 789161af728ba..e4e16eea895ca 100644 --- a/src/rgw/rgw_data_sync.cc +++ b/src/rgw/rgw_data_sync.cc @@ -3245,13 +3245,13 @@ int RGWBucketSyncStatusManager::init() { conn = store->get_zone_conn_by_id(source_zone); if (!conn) { - ldout(store->ctx(), 0) << "connection object to zone " << source_zone << " does not exist" << dendl; + ldpp_dout(this, 0) << "connection object to zone " << source_zone << " does not exist" << dendl; return -EINVAL; } int ret = http_manager.start(); if (ret < 0) { - ldout(store->ctx(), 0) << "failed in http_manager.start() ret=" << ret << dendl; + ldpp_dout(this, 0) << "failed in http_manager.start() ret=" << ret << dendl; return ret; } @@ -3266,7 +3266,7 @@ int RGWBucketSyncStatusManager::init() bucket_instance_meta_info result; ret = cr_mgr.run(new RGWReadRESTResourceCR(store->ctx(), conn, &http_manager, path, pairs, &result)); if (ret < 0) { - ldout(store->ctx(), 0) << "ERROR: failed to fetch bucket metadata info from zone=" << source_zone << " path=" << path << " key=" << key << " ret=" << ret << dendl; + ldpp_dout(this, 0) << "ERROR: failed to fetch bucket metadata info from zone=" << source_zone << " path=" << path << " key=" << key << " ret=" << ret << dendl; return ret; } @@ -3282,10 +3282,10 @@ int RGWBucketSyncStatusManager::init() auto async_rados = store->get_async_rados(); for (int i = 0; i < effective_num_shards; i++) { - RGWRemoteBucketLog *l = new RGWRemoteBucketLog(store, this, async_rados, &http_manager); + RGWRemoteBucketLog *l = new RGWRemoteBucketLog(this, store, this, async_rados, &http_manager); ret = l->init(source_zone, conn, bucket, (num_shards ? i : -1), error_logger, store->get_sync_tracer(), sync_module); if (ret < 0) { - ldout(store->ctx(), 0) << "ERROR: failed to initialize RGWRemoteBucketLog object" << dendl; + ldpp_dout(this, 0) << "ERROR: failed to initialize RGWRemoteBucketLog object" << dendl; return ret; } source_logs[i] = l; @@ -3323,7 +3323,7 @@ int RGWBucketSyncStatusManager::read_sync_status() int ret = cr_mgr.run(stacks); if (ret < 0) { - ldout(store->ctx(), 0) << "ERROR: failed to read sync status for " + ldpp_dout(this, 0) << "ERROR: failed to read sync status for " << bucket_str{bucket} << dendl; return ret; } @@ -3345,7 +3345,7 @@ int RGWBucketSyncStatusManager::run() int ret = cr_mgr.run(stacks); if (ret < 0) { - ldout(store->ctx(), 0) << "ERROR: failed to read sync status for " + ldpp_dout(this, 0) << "ERROR: failed to read sync status for " << bucket_str{bucket} << dendl; return ret; } @@ -3353,6 +3353,18 @@ int RGWBucketSyncStatusManager::run() return 0; } +unsigned RGWBucketSyncStatusManager::get_subsys() const +{ + return dout_subsys; +} + +std::ostream& RGWBucketSyncStatusManager::gen_prefix(std::ostream& out) const +{ + auto zone = std::string_view{source_zone}; + return out << "bucket sync zone:" << zone.substr(0, 8) + << " bucket:" << bucket.name << ' '; +} + string RGWBucketSyncStatusManager::status_oid(const string& source_zone, const rgw_bucket_shard& bs) { diff --git a/src/rgw/rgw_data_sync.h b/src/rgw/rgw_data_sync.h index 5d8f58986011b..5da4a148224d7 100644 --- a/src/rgw/rgw_data_sync.h +++ b/src/rgw/rgw_data_sync.h @@ -498,6 +498,7 @@ struct rgw_bucket_index_marker_info { class RGWRemoteBucketLog : public RGWCoroutinesManager { + const DoutPrefixProvider *dpp; RGWRados *store; RGWRESTConn *conn{nullptr}; string source_zone; @@ -513,9 +514,14 @@ class RGWRemoteBucketLog : public RGWCoroutinesManager { RGWBucketSyncCR *sync_cr{nullptr}; public: - RGWRemoteBucketLog(RGWRados *_store, RGWBucketSyncStatusManager *_sm, - RGWAsyncRadosProcessor *_async_rados, RGWHTTPManager *_http_manager) : RGWCoroutinesManager(_store->ctx(), _store->get_cr_registry()), store(_store), - status_manager(_sm), async_rados(_async_rados), http_manager(_http_manager) {} + RGWRemoteBucketLog(const DoutPrefixProvider *dpp, RGWRados *_store, + RGWBucketSyncStatusManager *_sm, + RGWAsyncRadosProcessor *_async_rados, + RGWHTTPManager *_http_manager) + : RGWCoroutinesManager(_store->ctx(), _store->get_cr_registry()), + dpp(dpp), store(_store), status_manager(_sm), + async_rados(_async_rados), http_manager(_http_manager) + {} int init(const string& _source_zone, RGWRESTConn *_conn, const rgw_bucket& bucket, int shard_id, @@ -531,7 +537,7 @@ public: void wakeup(); }; -class RGWBucketSyncStatusManager { +class RGWBucketSyncStatusManager : public DoutPrefixProvider { RGWRados *store; RGWCoroutinesManager cr_mgr; @@ -576,6 +582,11 @@ public: int read_sync_status(); int run(); + + // implements DoutPrefixProvider + CephContext *get_cct() const override { return store->ctx(); } + unsigned get_subsys() const override; + std::ostream& gen_prefix(std::ostream& out) const override; }; /// read the sync status of all bucket shards from the given source zone -- 2.39.5