]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: new configuration option to restrict journal payload size
authorJason Dillaman <dillaman@redhat.com>
Wed, 20 Jul 2016 12:11:53 +0000 (08:11 -0400)
committerJason Dillaman <dillaman@redhat.com>
Wed, 17 Aug 2016 17:22:05 +0000 (13:22 -0400)
Ensure that, by default, IO journal events are broken up into manageable
sizes when factoring in that an rbd-mirror daemon might be replaying
events from thousands of images.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
(cherry picked from commit 11d7500b9bcda7b7c1d8756ade3373f404257f32)

src/common/config_opts.h
src/librbd/ImageCtx.cc
src/librbd/ImageCtx.h
src/librbd/Journal.cc
src/test/librbd/mock/MockImageCtx.h

index 48234e7008bc60df8a18b47075fa522c1f9ba752..851f7c88e2827694edef1908dab442d011a53bdd 100644 (file)
@@ -1210,6 +1210,7 @@ OPTION(rbd_journal_object_flush_interval, OPT_INT, 0) // maximum number of pendi
 OPTION(rbd_journal_object_flush_bytes, OPT_INT, 0) // maximum number of pending bytes per journal object
 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
 
 /**
  * RBD Mirror options
index 87c710e9be4476015a7f6750e79a61a9c250bd23..868a8e3e2b7dd2ca5ca64ff20822efc22e198959 100644 (file)
@@ -938,7 +938,8 @@ struct C_InvalidateCache : public Context {
         "rbd_journal_object_flush_interval", false)(
         "rbd_journal_object_flush_bytes", false)(
         "rbd_journal_object_flush_age", false)(
-        "rbd_journal_pool", false);
+        "rbd_journal_pool", false)(
+        "rbd_journal_max_payload_bytes", false);
 
     md_config_t local_config_t;
     std::map<std::string, bufferlist> res;
@@ -993,6 +994,7 @@ struct C_InvalidateCache : public Context {
     ASSIGN_OPTION(journal_object_flush_bytes);
     ASSIGN_OPTION(journal_object_flush_age);
     ASSIGN_OPTION(journal_pool);
+    ASSIGN_OPTION(journal_max_payload_bytes);
   }
 
   ExclusiveLock<ImageCtx> *ImageCtx::create_exclusive_lock() {
index 076072c7a01879e3861194c9fe0ff056425f4dbb..3bd08966963eafea2d077c8420956277b32262c5 100644 (file)
@@ -185,6 +185,7 @@ namespace librbd {
     uint64_t journal_object_flush_bytes;
     double journal_object_flush_age;
     std::string journal_pool;
+    uint32_t journal_max_payload_bytes;
 
     LibrbdAdminSocketHook *asok_hook;
 
index cff29bd7783e706ee5aa56df62f8e9b281c203af..fe37fa1e87748df9b5b03b808db7dbaa65115ad5 100644 (file)
@@ -1189,6 +1189,7 @@ void Journal<I>::create_journaler() {
   transition_state(STATE_INITIALIZING, 0);
   ::journal::Settings settings;
   settings.commit_interval = m_image_ctx.journal_commit_age;
+  settings.max_payload_bytes = m_image_ctx.journal_max_payload_bytes;
 
   m_journaler = new Journaler(m_work_queue, m_timer, m_timer_lock,
                              m_image_ctx.md_ctx, m_image_ctx.id,
index 034db1c9f60bad2c914c7d00c55c9e7b5aab4822..b7b73c835fa6fc938c650fe4b819c5d11dd062b2 100644 (file)
@@ -86,7 +86,8 @@ struct MockImageCtx {
       journal_object_flush_interval(image_ctx.journal_object_flush_interval),
       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_pool(image_ctx.journal_pool),
+      journal_max_payload_bytes(image_ctx.journal_max_payload_bytes)
   {
     md_ctx.dup(image_ctx.md_ctx);
     data_ctx.dup(image_ctx.data_ctx);
@@ -240,6 +241,7 @@ struct MockImageCtx {
   uint64_t journal_object_flush_bytes;
   double journal_object_flush_age;
   std::string journal_pool;
+  uint32_t journal_max_payload_bytes;
 };
 
 } // namespace librbd