From 2abd5ac847d02577ad5898a57fc9e58dca5615e6 Mon Sep 17 00:00:00 2001 From: Yehuda Sadeh Date: Wed, 3 Aug 2016 11:22:00 -0700 Subject: [PATCH] rgw: define sync_module on RGWRados Instead of having it as part of the data sync module. Since we only have a single sync_module, having it there will make it easier to get its properties. Signed-off-by: Yehuda Sadeh --- src/rgw/rgw_data_sync.cc | 9 ++------- src/rgw/rgw_rados.cc | 6 ++++++ src/rgw/rgw_rados.h | 4 ++++ 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/rgw/rgw_data_sync.cc b/src/rgw/rgw_data_sync.cc index b93922413f78f..0be2bd44a7b07 100644 --- a/src/rgw/rgw_data_sync.cc +++ b/src/rgw/rgw_data_sync.cc @@ -1611,12 +1611,7 @@ int RGWDataSyncStatusManager::init() RGWZoneParams& zone_params = store->get_zone_params(); - int r = store->get_sync_modules_manager()->create_instance(zone_def.tier_type, zone_params.tier_config, &sync_module); - if (r < 0) { - lderr(store->ctx()) << "ERROR: failed to init sync module instance, r=" << r << dendl; - finalize(); - return r; - } + sync_module = store->get_sync_module(); conn = store->get_zone_conn_by_id(source_zone); if (!conn) { @@ -1626,7 +1621,7 @@ int RGWDataSyncStatusManager::init() const char *log_pool = zone_params.log_pool.name.c_str(); librados::Rados *rados = store->get_rados_handle(); - r = rados->ioctx_create(log_pool, ioctx); + int r = rados->ioctx_create(log_pool, ioctx); if (r < 0) { lderr(store->ctx()) << "ERROR: failed to open log pool (" << zone_params.log_pool.name << " ret=" << r << dendl; return r; diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index 84b63bd0e87ae..58d7edbc0801c 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -3792,6 +3792,12 @@ int RGWRados::init_complete() zone_short_id = current_period.get_map().get_zone_short_id(zone_params.get_id()); + ret = sync_modules_manager->create_instance(zone_public_config.tier_type, zone_params.tier_config, &sync_module); + if (ret < 0) { + lderr(cct) << "ERROR: failed to init sync module instance, ret=" << ret << dendl; + return ret; + } + init_unique_trans_id_deps(); finisher = new Finisher(cct); diff --git a/src/rgw/rgw_rados.h b/src/rgw/rgw_rados.h index 209269332cf44..5c42ca02ca376 100644 --- a/src/rgw/rgw_rados.h +++ b/src/rgw/rgw_rados.h @@ -1902,6 +1902,7 @@ protected: RGWCoroutinesManagerRegistry *cr_registry; RGWSyncModulesManager *sync_modules_manager{nullptr}; + RGWSyncModuleInstanceRef sync_module; RGWZoneGroup zonegroup; RGWZone zone_public_config; /* external zone params, e.g., entrypoints, log flags, etc. */ @@ -2047,6 +2048,9 @@ public: RGWSyncModulesManager *get_sync_modules_manager() { return sync_modules_manager; } + const RGWSyncModuleInstanceRef& get_sync_module() { + return sync_module; + } int get_required_alignment(rgw_bucket& bucket, uint64_t *alignment); int get_max_chunk_size(rgw_bucket& bucket, uint64_t *max_chunk_size); -- 2.39.5