From: Casey Bodley Date: Thu, 28 Feb 2019 20:56:55 +0000 (-0500) Subject: rgw: add sync perf counters to each RGWDataSyncProcessorThread X-Git-Tag: v14.2.2~129^2~4 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=89bb811dfd8646c6cd8cbdd968e28c0bd1c03093;p=ceph.git rgw: add sync perf counters to each RGWDataSyncProcessorThread Signed-off-by: Casey Bodley (cherry picked from commit 432569b33500441214c439ff3eccd5850ef59302) --- diff --git a/src/rgw/rgw_admin.cc b/src/rgw/rgw_admin.cc index 655685f0af6..48450934938 100644 --- a/src/rgw/rgw_admin.cc +++ b/src/rgw/rgw_admin.cc @@ -2163,7 +2163,7 @@ static void get_data_sync_status(const string& source_zone, list& status flush_ss(ss, status); return; } - RGWDataSyncStatusManager sync(store, store->get_async_rados(), source_zone); + RGWDataSyncStatusManager sync(store, store->get_async_rados(), source_zone, nullptr); int ret = sync.init(); if (ret < 0) { @@ -7034,7 +7034,7 @@ next: cerr << "ERROR: source zone not specified" << std::endl; return EINVAL; } - RGWDataSyncStatusManager sync(store, store->get_async_rados(), source_zone); + RGWDataSyncStatusManager sync(store, store->get_async_rados(), source_zone, nullptr); int ret = sync.init(); if (ret < 0) { @@ -7098,7 +7098,7 @@ next: return EINVAL; } - RGWDataSyncStatusManager sync(store, store->get_async_rados(), source_zone); + RGWDataSyncStatusManager sync(store, store->get_async_rados(), source_zone, nullptr); int ret = sync.init(); if (ret < 0) { @@ -7127,7 +7127,7 @@ next: return ret; } - RGWDataSyncStatusManager sync(store, store->get_async_rados(), source_zone, sync_module); + RGWDataSyncStatusManager sync(store, store->get_async_rados(), source_zone, nullptr, sync_module); ret = sync.init(); if (ret < 0) { diff --git a/src/rgw/rgw_data_sync.cc b/src/rgw/rgw_data_sync.cc index 90eb6bc2344..f4d361bed41 100644 --- a/src/rgw/rgw_data_sync.cc +++ b/src/rgw/rgw_data_sync.cc @@ -594,10 +594,11 @@ int RGWRemoteDataLog::read_source_log_shards_next(map shard_markers } int RGWRemoteDataLog::init(const string& _source_zone, RGWRESTConn *_conn, RGWSyncErrorLogger *_error_logger, - RGWSyncTraceManager *_sync_tracer, RGWSyncModuleInstanceRef& _sync_module) + RGWSyncTraceManager *_sync_tracer, RGWSyncModuleInstanceRef& _sync_module, + PerfCounters* counters) { sync_env.init(dpp, store->ctx(), store, _conn, async_rados, &http_manager, _error_logger, - _sync_tracer, _source_zone, _sync_module); + _sync_tracer, _source_zone, _sync_module, counters); if (initialized) { return 0; @@ -1872,7 +1873,8 @@ int RGWDataSyncStatusManager::init() error_logger = new RGWSyncErrorLogger(store, RGW_SYNC_ERROR_LOG_SHARD_PREFIX, ERROR_LOGGER_SHARDS); - int r = source_log.init(source_zone, conn, error_logger, store->get_sync_tracer(), sync_module); + int r = source_log.init(source_zone, conn, error_logger, store->get_sync_tracer(), + sync_module, counters); if (r < 0) { ldpp_dout(this, 0) << "ERROR: failed to init remote log, r=" << r << dendl; finalize(); @@ -1941,7 +1943,7 @@ int RGWRemoteBucketLog::init(const string& _source_zone, RGWRESTConn *_conn, bs.shard_id = shard_id; sync_env.init(dpp, store->ctx(), store, conn, async_rados, http_manager, - _error_logger, _sync_tracer, source_zone, _sync_module); + _error_logger, _sync_tracer, source_zone, _sync_module, nullptr); return 0; } @@ -3475,7 +3477,7 @@ int rgw_bucket_sync_status(const DoutPrefixProvider *dpp, RGWRados *store, const RGWDataSyncEnv env; RGWSyncModuleInstanceRef module; // null sync module env.init(dpp, store->ctx(), store, nullptr, store->get_async_rados(), - nullptr, nullptr, nullptr, source_zone, module); + nullptr, nullptr, nullptr, source_zone, module, nullptr); RGWCoroutinesManager crs(store->ctx(), store->get_cr_registry()); return crs.run(new RGWCollectBucketSyncStatusCR(store, &env, num_shards, diff --git a/src/rgw/rgw_data_sync.h b/src/rgw/rgw_data_sync.h index 2909fd42533..55a71d720da 100644 --- a/src/rgw/rgw_data_sync.h +++ b/src/rgw/rgw_data_sync.h @@ -244,13 +244,15 @@ struct RGWDataSyncEnv { RGWSyncTraceManager *sync_tracer{nullptr}; string source_zone; RGWSyncModuleInstanceRef sync_module{nullptr}; + PerfCounters* counters{nullptr}; RGWDataSyncEnv() {} void init(const DoutPrefixProvider *_dpp, CephContext *_cct, RGWRados *_store, RGWRESTConn *_conn, RGWAsyncRadosProcessor *_async_rados, RGWHTTPManager *_http_manager, RGWSyncErrorLogger *_error_logger, RGWSyncTraceManager *_sync_tracer, - const string& _source_zone, RGWSyncModuleInstanceRef& _sync_module) { + const string& _source_zone, RGWSyncModuleInstanceRef& _sync_module, + PerfCounters* _counters) { dpp = _dpp; cct = _cct; store = _store; @@ -261,6 +263,7 @@ struct RGWDataSyncEnv { sync_tracer = _sync_tracer; source_zone = _source_zone; sync_module = _sync_module; + counters = _counters; } string shard_obj_name(int shard_id); @@ -291,7 +294,8 @@ public: lock("RGWRemoteDataLog::lock"), data_sync_cr(NULL), initialized(false) {} int init(const string& _source_zone, RGWRESTConn *_conn, RGWSyncErrorLogger *_error_logger, - RGWSyncTraceManager *_sync_tracer, RGWSyncModuleInstanceRef& module); + RGWSyncTraceManager *_sync_tracer, RGWSyncModuleInstanceRef& module, + PerfCounters* _counters); void finish(); int read_log_info(rgw_datalog_info *log_info); @@ -314,6 +318,7 @@ class RGWDataSyncStatusManager : public DoutPrefixProvider { RGWRESTConn *conn; RGWSyncErrorLogger *error_logger; RGWSyncModuleInstanceRef sync_module; + PerfCounters* counters; RGWRemoteDataLog source_log; @@ -326,14 +331,15 @@ class RGWDataSyncStatusManager : public DoutPrefixProvider { public: RGWDataSyncStatusManager(RGWRados *_store, RGWAsyncRadosProcessor *async_rados, - const string& _source_zone) + const string& _source_zone, PerfCounters* counters) : store(_store), source_zone(_source_zone), conn(NULL), error_logger(NULL), - sync_module(nullptr), + sync_module(nullptr), counters(counters), source_log(this, store, async_rados), num_shards(0) {} RGWDataSyncStatusManager(RGWRados *_store, RGWAsyncRadosProcessor *async_rados, - const string& _source_zone, const RGWSyncModuleInstanceRef& _sync_module) + const string& _source_zone, PerfCounters* counters, + const RGWSyncModuleInstanceRef& _sync_module) : store(_store), source_zone(_source_zone), conn(NULL), error_logger(NULL), - sync_module(_sync_module), + sync_module(_sync_module), counters(counters), source_log(this, store, async_rados), num_shards(0) {} ~RGWDataSyncStatusManager() { finalize(); diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index 28bab39e298..5b84614e79b 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -66,6 +66,7 @@ using namespace librados; #include "rgw_object_expirer_core.h" #include "rgw_sync.h" +#include "rgw_sync_counters.h" #include "rgw_sync_trace.h" #include "rgw_data_sync.h" #include "rgw_realm_watcher.h" @@ -816,6 +817,7 @@ public: class RGWDataSyncProcessorThread : public RGWSyncProcessorThread { + PerfCountersRef counters; RGWDataSyncStatusManager sync; bool initialized; @@ -834,7 +836,8 @@ public: RGWDataSyncProcessorThread(RGWRados *_store, RGWAsyncRadosProcessor *async_rados, const RGWZone* source_zone) : RGWSyncProcessorThread(_store, "data-sync"), - sync(_store, async_rados, source_zone->id), + counters(sync_counters::build(store->ctx(), std::string("data-sync-from-") + source_zone->name)), + sync(_store, async_rados, source_zone->id, counters.get()), initialized(false) {} void wakeup_sync_shards(map >& shard_ids) {