mon/PaxosService: uninline should_trim()

Signed-off-by: Sage Weil <sage@inktank.com>
This commit is contained in:
Sage Weil 2013-07-08 21:33:22 -07:00
parent f1b4398dd2
commit 50ffe324e3
2 changed files with 16 additions and 15 deletions

View File

@ -326,6 +326,20 @@ void PaxosService::shutdown()
finish_contexts(g_ceph_context, waiting_for_finished_proposal, -EAGAIN); finish_contexts(g_ceph_context, waiting_for_finished_proposal, -EAGAIN);
} }
bool PaxosService::should_trim()
{
if (!service_should_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;
}
void PaxosService::trim(MonitorDBStore::Transaction *t, void PaxosService::trim(MonitorDBStore::Transaction *t,
version_t from, version_t to) version_t from, version_t to)
{ {

View File

@ -682,23 +682,10 @@ public:
virtual void encode_trim_extra(MonitorDBStore::Transaction *tx, version_t first) {} virtual void encode_trim_extra(MonitorDBStore::Transaction *tx, version_t first) {}
/** /**
* * decide whether we should trim service states
*/ */
virtual bool should_trim() { 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. * Check if we should trim.
* *