OPTION(paxos_min_wait, OPT_DOUBLE, 0.05) // min time to gather updates for after period of inactivity
OPTION(paxos_trim_tolerance, OPT_INT, 30) // number of extra proposals tolerated before trimming
OPTION(paxos_trim_disabled_max_versions, OPT_INT, 100) // maximum amount of versions we shall allow passing by without trimming
+OPTION(paxos_service_trim_max, OPT_INT, 50) // maximum amount of versions to trim during a single proposal (0 disables it)
+OPTION(paxos_service_trim_min, OPT_INT, 30) // minimum amount of versions to trigger a trim (0 disables it)
OPTION(clock_offset, OPT_DOUBLE, 0) // how much to offset the system clock in Clock.cc
OPTION(auth_cluster_required, OPT_STR, "cephx") // required of mon, mds, osd daemons
OPTION(auth_service_required, OPT_STR, "cephx") // required by daemons of clients
// we don't require full versions; don't encode any.
virtual void encode_full(MonitorDBStore::Transaction *t) { }
- bool should_trim() { return false; }
+ bool service_should_trim() { return false; }
void encode_trim(MonitorDBStore::Transaction *t) { }
void update_logger();
}
}
-bool OSDMonitor::should_trim()
+bool OSDMonitor::service_should_trim()
{
update_trim();
return (get_trim_to() > 0);
bool should_propose(double &delay);
void update_trim();
- bool should_trim();
+ bool service_should_trim();
bool can_mark_down(int o);
bool can_mark_up(int o);
if (should_trim()) {
encode_trim(&t);
- set_trim_to(0);
}
encode_pending(&t);
if (first_committed >= trim_to)
return;
- trim(t, first_committed, trim_to);
- put_first_committed(t, trim_to);
+ version_t trim_to_max = trim_to;
+ if ((g_conf->paxos_service_trim_max > 0)
+ && (trim_to - first_committed > (size_t)g_conf->paxos_service_trim_max)) {
+ trim_to_max = first_committed + g_conf->paxos_service_trim_max;
+ }
+
+ dout(10) << __func__ << " trimming versions " << first_committed
+ << " to " << trim_to_max << dendl;
+
+ trim(t, first_committed, trim_to_max);
+ put_first_committed(t, trim_to_max);
+
+ if (trim_to_max == trim_to)
+ set_trim_to(0);
}
* the log versions even if we don't have a full map in store.
*/
virtual void encode_trim(MonitorDBStore::Transaction *t);
+ /**
+ *
+ */
+ virtual bool should_trim() {
+ bool want_trim = service_should_trim();
+
+ if (!want_trim)
+ return false;
+
+ if (g_conf->paxos_service_trim_min > 0) {
+ version_t trim_to = get_trim_to();
+ version_t first = get_first_committed();
+
+ if ((trim_to > 0) && trim_to > first)
+ return ((trim_to - first) >= (version_t)g_conf->paxos_service_trim_min);
+ }
+ return true;
+ }
/**
* Check if we should trim.
*
*
* @returns true if we should trim; false otherwise.
*/
- virtual bool should_trim() {
+ virtual bool service_should_trim() {
update_trim();
return (get_trim_to() > 0);
}