From: Sage Weil Date: Tue, 9 Jul 2013 04:58:13 +0000 (-0700) Subject: mon/PaxosService: simplify paxos_service_trim_min check X-Git-Tag: v0.67-rc1~134^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d97f31424edd2c4a54bd4dc8dfc5f6ee4dc5a023;p=ceph.git mon/PaxosService: simplify paxos_service_trim_min check Signed-off-by: Sage Weil --- diff --git a/src/mon/PaxosService.cc b/src/mon/PaxosService.cc index 2f3bacc36dbf..72a1c5e531de 100644 --- a/src/mon/PaxosService.cc +++ b/src/mon/PaxosService.cc @@ -327,15 +327,15 @@ void PaxosService::maybe_trim() return; version_t trim_to = get_trim_to(); - if (trim_to == 0) + if (trim_to < get_first_committed()) return; - if (g_conf->paxos_service_trim_min > 0) { - version_t first = get_first_committed(); - if ((trim_to > 0) && - trim_to > first && - (trim_to - first) < (version_t)g_conf->paxos_service_trim_min) - return; // not enough to trim + version_t to_remove = trim_to - get_first_committed(); + if (g_conf->paxos_service_trim_min > 0 && + to_remove < g_conf->paxos_service_trim_min) { + dout(10) << __func__ << " trim_to " << trim_to << " would only trim " << to_remove + << " < paxos_service_trim_min " << g_conf->paxos_service_trim_min << dendl; + return; } dout(10) << __func__ << " trimming to " << trim_to << dendl;