mon/PaxosService: unwind should_trim()

Inline the single-caller helper.  This will help us in a moment...

Signed-off-by: Sage Weil <sage@inktank.com>
This commit is contained in:
Sage Weil 2013-07-08 21:44:05 -07:00
parent d600dc9321
commit 63fe8635ae
2 changed files with 17 additions and 23 deletions

View File

@ -323,31 +323,30 @@ void PaxosService::shutdown()
void PaxosService::maybe_trim()
{
if (is_writeable() && should_trim()) {
dout(10) << __func__ << " trimming" << dendl;
if (!is_writeable())
return;
MonitorDBStore::Transaction t;
encode_trim(&t);
bufferlist bl;
t.encode(bl);
paxos->propose_new_value(bl, new C_Committed(this));
}
}
bool PaxosService::should_trim()
{
update_trim();
if (get_trim_to() == 0)
return false;
return;
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;
if ((trim_to > 0) &&
trim_to > first &&
(trim_to - first) < (version_t)g_conf->paxos_service_trim_min)
return; // not enough to trim
}
dout(10) << __func__ << " trimming" << dendl;
MonitorDBStore::Transaction t;
encode_trim(&t);
bufferlist bl;
t.encode(bl);
paxos->propose_new_value(bl, new C_Committed(this));
}
void PaxosService::encode_trim(MonitorDBStore::Transaction *t)

View File

@ -686,11 +686,6 @@ public:
*/
virtual void encode_trim_extra(MonitorDBStore::Transaction *tx, version_t first) {}
/**
* decide whether we should trim service states
*/
bool should_trim();
/**
* Update our trim status. We do nothing here, because there is no
* straightforward way to update the trim version, since that's service