]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
journal: make commit and flush params configurable
authorMykola Golub <mgolub@mirantis.com>
Tue, 1 Sep 2015 20:09:52 +0000 (23:09 +0300)
committerMykola Golub <mgolub@mirantis.com>
Wed, 11 Nov 2015 15:00:02 +0000 (17:00 +0200)
Signed-off-by: Mykola Golub <mgolub@mirantis.com>
src/journal/Journaler.cc
src/journal/Journaler.h
src/test/journal/test_Journaler.cc

index 5bf732f974f8386eaeac59701eec86e2c69e40a4..35854de78acf15139ac9bfb37259f70efd8f58f6 100644 (file)
@@ -44,7 +44,7 @@ using namespace cls::journal;
 
 Journaler::Journaler(librados::IoCtx &header_ioctx,
                     const std::string &journal_id,
-                    const std::string &client_id)
+                    const std::string &client_id, double commit_interval)
   : m_client_id(client_id), m_metadata(NULL), m_player(NULL), m_recorder(NULL),
     m_trimmer(NULL)
 {
@@ -54,9 +54,8 @@ Journaler::Journaler(librados::IoCtx &header_ioctx,
   m_header_oid = JOURNAL_HEADER_PREFIX + journal_id;
   m_object_oid_prefix = JOURNAL_OBJECT_PREFIX + journal_id + ".";
 
-  // TODO configurable commit interval
   m_metadata = new JournalMetadata(m_header_ioctx, m_header_oid, m_client_id,
-                                   5);
+                                   commit_interval);
   m_metadata->get();
 }
 
@@ -182,14 +181,15 @@ void Journaler::committed(const Future &future) {
   m_trimmer->committed(future_impl->get_commit_tid());
 }
 
-void Journaler::start_append() {
+void Journaler::start_append(int flush_interval, uint64_t flush_bytes,
+                            double flush_age) {
   assert(m_recorder == NULL);
 
   // TODO verify active object set >= current replay object set
 
-  // TODO configurable flush intervals
   m_recorder = new JournalRecorder(m_data_ioctx, m_object_oid_prefix,
-                                   m_metadata, 0, 0, 0);
+                                  m_metadata, flush_interval, flush_bytes,
+                                  flush_age);
 }
 
 void Journaler::stop_append(Context *on_safe) {
index fa90b40e8e799e91f25e47f23ac63b112407b8bd..d35821891402e829202c156a66cf46a9fa675aa3 100644 (file)
@@ -27,7 +27,7 @@ class ReplayHandler;
 class Journaler {
 public:
   Journaler(librados::IoCtx &header_ioctx, const std::string &journal_id,
-           const std::string &client_id);
+           const std::string &client_id, double commit_interval);
   ~Journaler();
 
   int create(uint8_t order, uint8_t splay_width, int64_t pool_id);
@@ -43,7 +43,7 @@ public:
   bool try_pop_front(ReplayEntry *replay_entry);
   void stop_replay();
 
-  void start_append();
+  void start_append(int flush_interval, uint64_t flush_bytes, double flush_age);
   Future append(const std::string &tag, const bufferlist &bl);
   void flush(Context *on_safe);
   void stop_append(Context *on_safe);
index 4b81bbf9933275edd73967c84d238e3beb7d5cb5..5a19910e564a1512f24f596b999f7fcba0e798f0 100644 (file)
@@ -20,7 +20,7 @@ public:
   virtual void SetUp() {
     RadosTestFixture::SetUp();
     m_journal_id = get_temp_journal_id();
-    m_journaler = new journal::Journaler(m_ioctx, m_journal_id, CLIENT_ID);
+    m_journaler = new journal::Journaler(m_ioctx, m_journal_id, CLIENT_ID, 5);
   }
 
   virtual void TearDown() {
@@ -39,7 +39,7 @@ public:
   }
 
   int register_client(const std::string &client_id, const std::string &desc) {
-    journal::Journaler journaler(m_ioctx, m_journal_id, client_id);
+    journal::Journaler journaler(m_ioctx, m_journal_id, client_id, 5);
     return journaler.register_client(desc);
   }