From d97f31424edd2c4a54bd4dc8dfc5f6ee4dc5a023 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 8 Jul 2013 21:58:13 -0700 Subject: [PATCH] mon/PaxosService: simplify paxos_service_trim_min check Signed-off-by: Sage Weil --- src/mon/PaxosService.cc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/mon/PaxosService.cc b/src/mon/PaxosService.cc index 2f3bacc36dbf5..72a1c5e531de7 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; -- 2.39.5