From: Sage Weil Date: Mon, 5 Jun 2017 19:17:44 +0000 (-0400) Subject: common/LogEntry: make prune size tunable (and raise 50 -> 1024) X-Git-Tag: v12.1.0~247^2~4 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=f1239e2e8097a14fbebadcff9740bf040f56083f;p=ceph.git common/LogEntry: make prune size tunable (and raise 50 -> 1024) Signed-off-by: Sage Weil --- diff --git a/src/common/LogEntry.h b/src/common/LogEntry.h index e8488dd4803..790b8662b13 100644 --- a/src/common/LogEntry.h +++ b/src/common/LogEntry.h @@ -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::const_iterator p = tail.begin(); diff --git a/src/common/config_opts.h b/src/common/config_opts.h index 37810a475a3..610530044ca 100644 --- a/src/common/config_opts.h +++ b/src/common/config_opts.h @@ -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 diff --git a/src/mon/LogMonitor.cc b/src/mon/LogMonitor.cc index bf30f3b4bd5..5555a71bb1f 100644 --- a/src/mon/LogMonitor.cc +++ b/src/mon/LogMonitor.cc @@ -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(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(le.stamp, le)); wait_for_finished_proposal(op, new Monitor::C_Command( mon, op, 0, string(), get_last_committed() + 1));