From: Yehuda Sadeh Date: Mon, 2 Nov 2015 18:43:24 +0000 (-0800) Subject: rgw: fix data sync initialization X-Git-Tag: v10.1.0~354^2~251 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=111cb41c208c26977d98b2748b9bc126aa038b48;p=ceph.git rgw: fix data sync initialization Signed-off-by: Yehuda Sadeh --- diff --git a/src/rgw/rgw_data_sync.cc b/src/rgw/rgw_data_sync.cc index 315014a84c9c..254d69b87451 100644 --- a/src/rgw/rgw_data_sync.cc +++ b/src/rgw/rgw_data_sync.cc @@ -353,6 +353,10 @@ int RGWRemoteDataLog::read_log_info(rgw_datalog_info *log_info) int RGWRemoteDataLog::init(const string& _source_zone, RGWRESTConn *_conn) { + if (initialized) { + return 0; + } + CephContext *cct = store->ctx(); async_rados = new RGWAsyncRadosProcessor(store, cct->_conf->rgw_num_async_rados_threads); async_rados->start(); @@ -362,10 +366,15 @@ int RGWRemoteDataLog::init(const string& _source_zone, RGWRESTConn *_conn) int ret = http_manager.set_threaded(); if (ret < 0) { + async_rados->stop(); + delete async_rados; + async_rados = NULL; ldout(store->ctx(), 0) << "failed in http_manager.set_threaded() ret=" << ret << dendl; return ret; } + initialized = true; + return 0; } diff --git a/src/rgw/rgw_data_sync.h b/src/rgw/rgw_data_sync.h index 787804bff610..3d08272b29cf 100644 --- a/src/rgw/rgw_data_sync.h +++ b/src/rgw/rgw_data_sync.h @@ -141,11 +141,14 @@ class RGWRemoteDataLog : public RGWCoroutinesManager { RWLock lock; RGWDataSyncCR *data_sync_cr; + bool initialized; + public: RGWRemoteDataLog(RGWRados *_store, RGWDataSyncStatusManager *_sm) : RGWCoroutinesManager(_store->ctx()), store(_store), conn(NULL), http_manager(store->ctx(), &completion_mgr), - status_manager(_sm), lock("RGWRemoteDataLog::lock"), data_sync_cr(NULL) {} + status_manager(_sm), lock("RGWRemoteDataLog::lock"), data_sync_cr(NULL), + initialized(false) {} int init(const string& _source_zone, RGWRESTConn *_conn); void finish(); diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index 3959af74bc67..763bc9e29e2b 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -2703,7 +2703,7 @@ class RGWDataSyncProcessorThread : public RGWSyncProcessorThread return 0; /* no interval associated, it'll run once until stopped */ } else { #define DATA_SYNC_INIT_WAIT_SEC 20 - return DATA_SYNC_INIT_WAIT_SEC; + return DATA_SYNC_INIT_WAIT_SEC * 1000; } } void stop_process() {