]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: optionally flag "laggy" journal clients disconnected
authorMykola Golub <mgolub@mirantis.com>
Wed, 27 Jul 2016 11:06:42 +0000 (14:06 +0300)
committerMykola Golub <mgolub@mirantis.com>
Mon, 5 Sep 2016 05:51:54 +0000 (08:51 +0300)
Fixes: http://tracker.ceph.com/issues/14738
Signed-off-by: Mykola Golub <mgolub@mirantis.com>
src/common/config_opts.h
src/librbd/ImageCtx.cc
src/librbd/ImageCtx.h
src/librbd/Journal.cc
src/test/librbd/mock/MockImageCtx.h

index fd9e0c5c83826e4f1defa9390df3a60023178270..f797f6034b5ad341ab4d27358c84529f96277ce7 100644 (file)
@@ -1252,6 +1252,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
index 5e3cffdebf069ddbba1334736e87d7b2e7339332..e8054353e942c5b58544c4b0f44daa8f7a5838cb 100644 (file)
@@ -944,7 +944,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<std::string, bufferlist> res;
@@ -1000,6 +1001,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> *ImageCtx::create_exclusive_lock() {
index b7a7eeae027421179dbbd1ecf7ddf8ae25e73235..f087fc027d45ae1e1bdd7e90387b6e6e828131ab 100644 (file)
@@ -188,6 +188,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;
 
index a82e84578c38988378a3f55d71c78c7d38bfeb3a..b6738c9ee994063ce553fd47f70c0792ccf85d4d 100644 (file)
@@ -1141,6 +1141,11 @@ void Journal<I>::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,
index e762fe6fba93cc6a6a4b3a2a45532376d11e553b..ddb4af3df4731e9d8453a395af392e9d64a2ad0a 100644 (file)
@@ -92,7 +92,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);
@@ -260,6 +262,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