OPTION(paxos_min, OPT_INT, 500) // minimum number of paxos states to keep around
OPTION(paxos_trim_min, OPT_INT, 250) // number of extra proposals tolerated before trimming
OPTION(paxos_trim_max, OPT_INT, 500) // max number of extra proposals to trim at a time
-OPTION(paxos_trim_disabled_max_versions, OPT_INT, 108000) // maximum amount of versions we shall allow passing by without trimming
OPTION(paxos_service_trim_min, OPT_INT, 250) // minimum amount of versions to trigger a trim (0 disables it)
OPTION(paxos_service_trim_max, OPT_INT, 500) // maximum amount of versions to trim during a single proposal (0 disables it)
OPTION(clock_offset, OPT_DOUBLE, 0) // how much to offset the system clock in Clock.cc
queue_proposal(bl, new C_Trimmed(this));
}
-void Paxos::trim_enable()
-{
- trim_disabled_version = 0;
- // We may not be the leader when we reach this function. We sure must
- // have been the leader at some point, but we may have been demoted and
- // we really should reset 'trim_disabled_version' if that was the case.
- // So, make sure we only trim() iff we are the leader.
- if (mon->is_leader() && should_trim())
- trim();
-}
-
/*
* return a globally unique, monotonically increasing proposal number
*/
last_pn++;
last_pn *= 100;
last_pn += (version_t)mon->rank;
-
+
// write
MonitorDBStore::Transaction t;
t.put(get_name(), "last_pn", last_pn);
* trimming; false otherwise.
*/
bool trimming;
- /**
- * If we have disabled trimming our state, this variable should have a
- * value greater than zero, corresponding to the version we had at the time
- * we disabled the trim.
- */
- version_t trim_disabled_version;
/**
* @defgroup Paxos_h_callbacks Callback classes.
lease_timeout_event(0),
accept_timeout_event(0),
clock_drift_warned(0),
- trimming(false),
- trim_disabled_version(0) { }
+ trimming(false) { }
const string get_name() const {
return paxos_name;
*/
void trim();
- /**
- * Disable trimming
- *
- * This is required by the Monitor's store synchronization mechanisms
- * to guarantee a consistent store state.
- */
- void trim_disable() {
- if (!trim_disabled_version)
- trim_disabled_version = get_version();
- }
- /**
- * Enable trimming
- */
- void trim_enable();
- /**
- * Check if trimming has been disabled
- *
- * @returns true if trim has been disabled; false otherwise.
- */
- bool is_trim_disabled() { return (trim_disabled_version > 0); }
/**
* Check if we should trim.
*
if (trimming || (available_versions <= maximum_versions))
return false;
- if (trim_disabled_version > 0) {
- int disabled_versions = (get_version() - trim_disabled_version);
- if (disabled_versions < g_conf->paxos_trim_disabled_max_versions)
- return false;
- }
return true;
}