Skip to content

Commit

Permalink
rbd-mirror: configuration overrides for hard coded timers
Browse files Browse the repository at this point in the history
Signed-off-by: Dongsheng Yang <dongsheng.yang@easystack.cn>
  • Loading branch information
yangdongsheng committed Nov 14, 2016
1 parent d2705be commit a0fccea
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 8 deletions.
4 changes: 4 additions & 0 deletions src/common/config_opts.h
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions src/tools/rbd_mirror/ImageDeleter.cc
Expand Up @@ -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");
}

Expand Down
3 changes: 1 addition & 2 deletions src/tools/rbd_mirror/ImageDeleter.h
Expand Up @@ -119,8 +119,7 @@ class ImageDeleter {
ImageDeleterThread m_image_deleter_thread;

std::deque<std::unique_ptr<DeleteInfo>> 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;

Expand Down
5 changes: 2 additions & 3 deletions src/tools/rbd_mirror/Mirror.cc
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down
8 changes: 5 additions & 3 deletions src/tools/rbd_mirror/Replayer.cc
Expand Up @@ -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");
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit a0fccea

Please sign in to comment.