]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
common/LogEntry: make prune size tunable (and raise 50 -> 1024)
authorSage Weil <sage@redhat.com>
Mon, 5 Jun 2017 19:17:44 +0000 (15:17 -0400)
committerSage Weil <sage@redhat.com>
Mon, 5 Jun 2017 19:17:44 +0000 (15:17 -0400)
Signed-off-by: Sage Weil <sage@redhat.com>
src/common/LogEntry.h
src/common/config_opts.h
src/mon/LogMonitor.cc

index e8488dd48039b25e8d94ee72d64260c7b1f77f96..790b8662b131f0914fc3afb71d4ba49930444a67 100644 (file)
@@ -102,8 +102,11 @@ struct LogSummary {
 
   void add(const LogEntry& e) {
     tail.push_back(e);
-    while (tail.size() > 50)
+  }
+  void prune(size_t max) {
+    while (tail.size() > max) {
       tail.pop_front();
+    }
   }
   bool contains(const LogEntryKey& k) const {
     for (list<LogEntry>::const_iterator p = tail.begin();
index 37810a475a39a54dd1f9fa1140bdd08c149e3960..610530044ca0115eda347b06f347494feda4b2f5 100644 (file)
@@ -340,6 +340,7 @@ OPTION(mon_max_osd, OPT_INT, 10000)
 OPTION(mon_probe_timeout, OPT_DOUBLE, 2.0)
 OPTION(mon_client_bytes, OPT_U64, 100ul << 20)  // client msg data allowed in memory (in bytes)
 OPTION(mon_mgr_proxy_client_bytes_ratio, OPT_FLOAT, .3) // ratio of mon_client_bytes that can be consumed by proxied mgr commands before we error out to client
+OPTION(mon_log_max_summary, OPT_U64, 50)
 OPTION(mon_daemon_bytes, OPT_U64, 400ul << 20)  // mds, osd message memory cap (in bytes)
 OPTION(mon_max_log_entries_per_event, OPT_INT, 4096)
 OPTION(mon_reweight_min_pgs_per_osd, OPT_U64, 10)   // min pgs per osd for reweight-by-pg command
index bf30f3b4bd505b3062f0353030fd8c0a49d9f67c..5555a71bb1f0122b063adb5c917bbf4dd53cb042 100644 (file)
@@ -165,6 +165,7 @@ void LogMonitor::update_from_paxos(bool *need_bootstrap)
     }
 
     summary.version++;
+    summary.prune(g_conf->mon_log_max_summary);
   }
 
   dout(15) << __func__ << " logging for "
@@ -345,6 +346,7 @@ bool LogMonitor::prepare_log(MonOpRequestRef op)
       pending_log.insert(pair<utime_t,LogEntry>(p->stamp, *p));
     }
   }
+  pending_summary.prune(g_conf->mon_log_max_summary);
   wait_for_finished_proposal(op, new C_Log(this, op));
   return true;
 }
@@ -421,6 +423,7 @@ bool LogMonitor::prepare_command(MonOpRequestRef op)
     le.prio = CLOG_INFO;
     le.msg = str_join(logtext, " ");
     pending_summary.add(le);
+    pending_summary.prune(g_conf->mon_log_max_summary);
     pending_log.insert(pair<utime_t,LogEntry>(le.stamp, le));
     wait_for_finished_proposal(op, new Monitor::C_Command(
           mon, op, 0, string(), get_last_committed() + 1));