From: Mykola Golub Date: Wed, 27 Jul 2016 11:06:42 +0000 (+0300) Subject: librbd: optionally flag "laggy" journal clients disconnected X-Git-Tag: v10.2.4~61^2~42 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d3ad2ff9dff192d93d2fbef82ec0ccd37809d2ca;p=ceph.git librbd: optionally flag "laggy" journal clients disconnected Fixes: http://tracker.ceph.com/issues/14738 Signed-off-by: Mykola Golub (cherry picked from commit b8eafefba9f2221a0ce927568795cb1c3ac0fa9c) --- diff --git a/src/common/config_opts.h b/src/common/config_opts.h index 8ee70e3c31d..ba1c48c4064 100644 --- a/src/common/config_opts.h +++ b/src/common/config_opts.h @@ -1212,6 +1212,7 @@ OPTION(rbd_journal_object_flush_bytes, OPT_INT, 0) // maximum number of pending OPTION(rbd_journal_object_flush_age, OPT_DOUBLE, 0) // maximum age (in seconds) for pending commits OPTION(rbd_journal_pool, OPT_STR, "") // pool for journal objects OPTION(rbd_journal_max_payload_bytes, OPT_U32, 16384) // maximum journal payload size before splitting +OPTION(rbd_journal_max_concurrent_object_sets, OPT_INT, 0) // maximum number of object sets a journal client can be behind before it is automatically unregistered /** * RBD Mirror options diff --git a/src/librbd/ImageCtx.cc b/src/librbd/ImageCtx.cc index df1d837a106..c1d21f070cb 100644 --- a/src/librbd/ImageCtx.cc +++ b/src/librbd/ImageCtx.cc @@ -929,7 +929,8 @@ struct C_InvalidateCache : public Context { "rbd_journal_object_flush_bytes", false)( "rbd_journal_object_flush_age", false)( "rbd_journal_pool", false)( - "rbd_journal_max_payload_bytes", false); + "rbd_journal_max_payload_bytes", false)( + "rbd_journal_max_concurrent_object_sets", false); md_config_t local_config_t; std::map res; @@ -985,6 +986,7 @@ struct C_InvalidateCache : public Context { ASSIGN_OPTION(journal_object_flush_age); ASSIGN_OPTION(journal_pool); ASSIGN_OPTION(journal_max_payload_bytes); + ASSIGN_OPTION(journal_max_concurrent_object_sets); } ExclusiveLock *ImageCtx::create_exclusive_lock() { diff --git a/src/librbd/ImageCtx.h b/src/librbd/ImageCtx.h index 7660f6e5546..552d8a8eb5d 100644 --- a/src/librbd/ImageCtx.h +++ b/src/librbd/ImageCtx.h @@ -183,6 +183,7 @@ namespace librbd { double journal_object_flush_age; std::string journal_pool; uint32_t journal_max_payload_bytes; + int journal_max_concurrent_object_sets; LibrbdAdminSocketHook *asok_hook; diff --git a/src/librbd/Journal.cc b/src/librbd/Journal.cc index f98977bac6d..af44f00752c 100644 --- a/src/librbd/Journal.cc +++ b/src/librbd/Journal.cc @@ -1201,6 +1201,11 @@ void Journal::create_journaler() { ::journal::Settings settings; settings.commit_interval = m_image_ctx.journal_commit_age; settings.max_payload_bytes = m_image_ctx.journal_max_payload_bytes; + settings.max_concurrent_object_sets = + m_image_ctx.journal_max_concurrent_object_sets; + // TODO: a configurable filter to exclude certain peers from being + // disconnected. + settings.whitelisted_laggy_clients = {IMAGE_CLIENT_ID}; m_journaler = new Journaler(m_work_queue, m_timer, m_timer_lock, m_image_ctx.md_ctx, m_image_ctx.id, diff --git a/src/test/librbd/mock/MockImageCtx.h b/src/test/librbd/mock/MockImageCtx.h index ae0f3d67fbd..3dd3962d169 100644 --- a/src/test/librbd/mock/MockImageCtx.h +++ b/src/test/librbd/mock/MockImageCtx.h @@ -91,7 +91,9 @@ struct MockImageCtx { journal_object_flush_bytes(image_ctx.journal_object_flush_bytes), journal_object_flush_age(image_ctx.journal_object_flush_age), journal_pool(image_ctx.journal_pool), - journal_max_payload_bytes(image_ctx.journal_max_payload_bytes) + journal_max_payload_bytes(image_ctx.journal_max_payload_bytes), + journal_max_concurrent_object_sets( + image_ctx.journal_max_concurrent_object_sets) { md_ctx.dup(image_ctx.md_ctx); data_ctx.dup(image_ctx.data_ctx); @@ -257,6 +259,7 @@ struct MockImageCtx { double journal_object_flush_age; std::string journal_pool; uint32_t journal_max_payload_bytes; + int journal_max_concurrent_object_sets; }; } // namespace librbd