From 47127a9cb32b0399a10926b8b0875c794b4f5c23 Mon Sep 17 00:00:00 2001 From: Aishwarya Mathuria Date: Mon, 29 Mar 2021 19:35:12 +0530 Subject: [PATCH] =?utf8?q?mon:=20Adding=20variables=20for=20Paxos=20trim?= =?utf8?q?=20=20=20=20=20=201.=20Define=20variables=20for=20paxos=5Fservic?= =?utf8?q?e=5Ftrim=5Fmin=20and=20paxos=5Fservice=5Ftrim=5Fmax.=20=20=20=20?= =?utf8?q?=20=202.=20Use=20them=20in=20place=20of=20g=5Fconf()=E2=86=92pax?= =?utf8?q?os=5Fservice=5Ftrim=5Fmin=20and=20g=5Fconf()=E2=86=92paxos=5Fser?= =?utf8?q?vice=5Ftrim=5Fmax?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Aishwarya Mathuria (cherry picked from commit 45c59f2f0d0d90beb9163804e86139c551cf505b) --- src/mon/PaxosService.cc | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/mon/PaxosService.cc b/src/mon/PaxosService.cc index 06776635f9496..987a55adb131e 100644 --- a/src/mon/PaxosService.cc +++ b/src/mon/PaxosService.cc @@ -377,20 +377,22 @@ void PaxosService::maybe_trim() return; version_t to_remove = trim_to - get_first_committed(); - if (g_conf()->paxos_service_trim_min > 0 && - to_remove < (version_t)g_conf()->paxos_service_trim_min) { + const version_t trim_min = g_conf().get_val("paxos_service_trim_min"); + if (trim_min > 0 && + to_remove < 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; + << " < paxos_service_trim_min " << trim_min << dendl; return; } - if (g_conf()->paxos_service_trim_max > 0 && - to_remove > (version_t)g_conf()->paxos_service_trim_max) { + const version_t trim_max = g_conf().get_val("paxos_service_trim_max"); + if (trim_max > 0 && + to_remove > trim_max) { dout(10) << __func__ << " trim_to " << trim_to << " would only trim " << to_remove - << " > paxos_service_trim_max, limiting to " << g_conf()->paxos_service_trim_max + << " > paxos_service_trim_max, limiting to " << trim_max << dendl; - trim_to = get_first_committed() + g_conf()->paxos_service_trim_max; - to_remove = g_conf()->paxos_service_trim_max; + trim_to = get_first_committed() + trim_max; + to_remove = trim_max; } dout(10) << __func__ << " trimming to " << trim_to << ", " << to_remove << " states" << dendl; -- 2.39.5