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();
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
}
summary.version++;
+ summary.prune(g_conf->mon_log_max_summary);
}
dout(15) << __func__ << " logging for "
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;
}
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));