From a0fccea742a31128e936387802c1242c9842006e Mon Sep 17 00:00:00 2001 From: Dongsheng Yang Date: Tue, 8 Nov 2016 19:39:10 -0500 Subject: [PATCH] rbd-mirror: configuration overrides for hard coded timers Signed-off-by: Dongsheng Yang --- src/common/config_opts.h | 4 ++++ src/tools/rbd_mirror/ImageDeleter.cc | 1 + src/tools/rbd_mirror/ImageDeleter.h | 3 +-- src/tools/rbd_mirror/Mirror.cc | 5 ++--- src/tools/rbd_mirror/Replayer.cc | 8 +++++--- 5 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/common/config_opts.h b/src/common/config_opts.h index fbbb1228bd27f..5b669487958e2 100644 --- a/src/common/config_opts.h +++ b/src/common/config_opts.h @@ -1319,6 +1319,10 @@ OPTION(rbd_mirror_journal_poll_age, OPT_DOUBLE, 5) // maximum age (in seconds) b OPTION(rbd_mirror_journal_max_fetch_bytes, OPT_U32, 32768) // maximum bytes to read from each journal data object per fetch OPTION(rbd_mirror_sync_point_update_age, OPT_DOUBLE, 30) // number of seconds between each update of the image sync point object number OPTION(rbd_mirror_concurrent_image_syncs, OPT_U32, 5) // maximum number of image syncs in parallel +OPTION(rbd_mirror_pool_replayers_refresh_interval, OPT_INT, 30) // interval to refresh peers in rbd-mirror daemon +OPTION(rbd_mirror_delete_retry_interval, OPT_DOUBLE, 30) // interval to check and retry the failed requests in deleter +OPTION(rbd_mirror_image_directory_refresh_interval, OPT_INT, 30) // interval to refresh images in pool watcher +OPTION(rbd_mirror_image_state_check_interval, OPT_INT, 30) // interval to get images from pool watcher and set sources in replayer OPTION(nss_db_path, OPT_STR, "") // path to nss db diff --git a/src/tools/rbd_mirror/ImageDeleter.cc b/src/tools/rbd_mirror/ImageDeleter.cc index 0b0c775dba0d1..d879368e3c2cd 100644 --- a/src/tools/rbd_mirror/ImageDeleter.cc +++ b/src/tools/rbd_mirror/ImageDeleter.cc @@ -141,6 +141,7 @@ ImageDeleter::ImageDeleter(ContextWQ *work_queue, SafeTimer *timer, m_failed_timer_lock(timer_lock), m_asok_hook(new ImageDeleterAdminSocketHook(g_ceph_context, this)) { + set_failed_timer_interval(g_ceph_context->_conf->rbd_mirror_delete_retry_interval); m_image_deleter_thread.create("image_deleter"); } diff --git a/src/tools/rbd_mirror/ImageDeleter.h b/src/tools/rbd_mirror/ImageDeleter.h index d9b0f2e743405..32d1c66345b92 100644 --- a/src/tools/rbd_mirror/ImageDeleter.h +++ b/src/tools/rbd_mirror/ImageDeleter.h @@ -119,8 +119,7 @@ private: ImageDeleterThread m_image_deleter_thread; std::deque> m_failed_queue; - // TODO: make interval value configurable - double m_failed_interval = 30; + double m_failed_interval; SafeTimer *m_failed_timer; Mutex *m_failed_timer_lock; diff --git a/src/tools/rbd_mirror/Mirror.cc b/src/tools/rbd_mirror/Mirror.cc index d3aba0c63be24..8d5b83a08ae53 100644 --- a/src/tools/rbd_mirror/Mirror.cc +++ b/src/tools/rbd_mirror/Mirror.cc @@ -16,7 +16,6 @@ #define dout_prefix *_dout << "rbd::mirror::Mirror: " << this << " " \ << __func__ << ": " -using std::chrono::seconds; using std::list; using std::map; using std::set; @@ -235,8 +234,8 @@ void Mirror::run() if (!m_manual_stop) { update_replayers(m_local_cluster_watcher->get_pool_peers()); } - // TODO: make interval configurable - m_cond.WaitInterval(g_ceph_context, m_lock, seconds(30)); + m_cond.WaitInterval(g_ceph_context, m_lock, + utime_t(m_cct->_conf->rbd_mirror_pool_replayers_refresh_interval, 0)); } // stop all replayers in parallel diff --git a/src/tools/rbd_mirror/Replayer.cc b/src/tools/rbd_mirror/Replayer.cc index f3ccca9b35b2a..78c2091e9e80b 100644 --- a/src/tools/rbd_mirror/Replayer.cc +++ b/src/tools/rbd_mirror/Replayer.cc @@ -303,8 +303,9 @@ int Replayer::init() // Bootstrap existing mirroring images init_local_mirroring_images(); - // TODO: make interval configurable - m_pool_watcher.reset(new PoolWatcher(m_remote_io_ctx, 30, m_lock, m_cond)); + m_pool_watcher.reset(new PoolWatcher(m_remote_io_ctx, + g_ceph_context->_conf->rbd_mirror_image_directory_refresh_interval, + m_lock, m_cond)); m_pool_watcher->refresh_images(); m_replayer_thread.create("replayer"); @@ -456,7 +457,8 @@ void Replayer::run() if (m_blacklisted) { break; } - m_cond.WaitInterval(g_ceph_context, m_lock, seconds(30)); + m_cond.WaitInterval(g_ceph_context, m_lock, + utime_t(g_ceph_context->_conf->rbd_mirror_image_state_check_interval, 0)); } ImageIds empty_sources; -- 2.39.5