]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: limit size of each logm paxos event
authorSage Weil <sage@inktank.com>
Tue, 5 Jun 2012 20:54:57 +0000 (13:54 -0700)
committerSage Weil <sage@inktank.com>
Tue, 5 Jun 2012 23:38:54 +0000 (16:38 -0700)
Limit the number of log events we cram into a single paxos event.

Fixes: #2518
Signed-off-by: Sage Weil <sage@inktank.com>
Reviewed-by: Yehuda Sadeh <yehuda@inktank.com>
Reviewed-by: Joao Eduardo Luis <joao.luis@inktank.com>
src/common/config_opts.h
src/mon/LogMonitor.cc
src/mon/LogMonitor.h

index 7144ef4427b5b976052e48248c2a4d88b83dffea..cf40d01005423b8c7618552e224beff2aa21ceb6 100644 (file)
@@ -126,6 +126,7 @@ OPTION(mon_probe_timeout, OPT_DOUBLE, 2.0)
 OPTION(mon_slurp_timeout, OPT_DOUBLE, 10.0)
 OPTION(mon_slurp_bytes, OPT_INT, 256*1024)    // limit size of slurp messages
 OPTION(mon_client_bytes, OPT_U64, 500ul<<20)  // client msg data allowed in memory (in bytes)
+OPTION(mon_max_log_entries_per_event, OPT_INT, 4096)
 OPTION(paxos_max_join_drift, OPT_INT, 10)       // max paxos iterations before we must first slurp
 OPTION(paxos_propose_interval, OPT_DOUBLE, 1.0)  // gather updates for this long before proposing a map update
 OPTION(paxos_min_wait, OPT_DOUBLE, 0.05)  // min time to gather updates for after period of inactivity
index e126b746776a43197ffe7d14cbba801d431b0cdf..f3287b86dcd703947e0c3aec7ce7c700e188dbe1 100644 (file)
@@ -290,6 +290,16 @@ void LogMonitor::_updated_log(MLog *m)
   m->put();
 }
 
+bool LogMonitor::should_propose(double& delay)
+{
+  // commit now if we have a lot of pending events
+  if (g_conf->mon_max_log_entries_per_event > 0 &&
+      pending_log.size() >= (unsigned)g_conf->mon_max_log_entries_per_event)
+    return true;
+
+  // otherwise fall back to generic policy
+  return PaxosService::should_propose(delay);
+}
 
 
 bool LogMonitor::preprocess_command(MMonCommand *m)
index c84d0aee07457e8b76bd0dae2ac782d8a9494cb0..df995792a7c24000cca9635d99123ea6d3a35eb9 100644 (file)
@@ -45,6 +45,8 @@ private:
   bool prepare_log(MLog *m);
   void _updated_log(MLog *m);
 
+  bool should_propose(double& delay);
+
   struct C_Log : public Context {
     LogMonitor *logmon;
     MLog *ack;