mon: Modifying trim logic to change paxos_service_trim_max dynamically

Currently, the Paxos Service trim logic is bounded by a max value (paxos_service_trim_max). This change dynamically modifies the max value when the number of logs to be trimmed is higher than paxos_service_trim_max.

 The paxos_service_trim_max_multiplier has been added in case we want to increase paxos_service_trim_max by a certain factor. If this option is enabled we get a new upper bound when trim sizes are high.

Fixes: https://tracker.ceph.com/issues/50004

Signed-off-by: Aishwarya Mathuria <amathuri@redhat.com>
This commit is contained in:
Aishwarya Mathuria 2021-03-12 16:57:40 +05:30
parent 45c59f2f0d
commit 2e1141e439
3 changed files with 38 additions and 12 deletions

View File

@ -766,7 +766,15 @@ Trimming requires that the placement groups are ``active+clean``.
:Default: ``500``
``mon_mds_force_trim_to``
``paxos service trim max multiplier``
:Description: The factor by which paxos service trim max will be multiplied
to get a new upper bound when trim sizes are high (0 disables it)
:Type: Integer
:Default: ``20``
``mon mds force trim to``
:Description: Force monitor to trim mdsmaps to this point (0 disables it.
dangerous, use with care)

View File

@ -2281,16 +2281,23 @@ std::vector<Option> get_global_options() {
.add_service("mon")
.set_description(""),
Option("paxos_service_trim_min", Option::TYPE_INT, Option::LEVEL_ADVANCED)
Option("paxos_service_trim_min", Option::TYPE_UINT, Option::LEVEL_ADVANCED)
.set_default(250)
.add_service("mon")
.set_description(""),
Option("paxos_service_trim_max", Option::TYPE_INT, Option::LEVEL_ADVANCED)
Option("paxos_service_trim_max", Option::TYPE_UINT, Option::LEVEL_ADVANCED)
.set_default(500)
.add_service("mon")
.set_description(""),
Option("paxos_service_trim_max_multiplier", Option::TYPE_UINT, Option::LEVEL_ADVANCED)
.set_default(20)
.set_min(0)
.add_service("mon")
.set_description("factor by which paxos_service_trim_max will be multiplied to get a new upper bound when trim sizes are high (0 disables it)")
.set_flag(Option::FLAG_RUNTIME),
Option("paxos_kill_at", Option::TYPE_INT, Option::LEVEL_DEV)
.set_default(0)
.add_service("mon")

View File

@ -393,15 +393,26 @@ void PaxosService::maybe_trim()
return;
}
const version_t trim_max = g_conf().get_val<version_t>("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 " << trim_max
<< dendl;
trim_to = get_first_committed() + trim_max;
to_remove = trim_max;
}
to_remove = [to_remove, this] {
const version_t trim_max = g_conf().get_val<version_t>("paxos_service_trim_max");
if (trim_max == 0 || to_remove < trim_max) {
return to_remove;
}
if (to_remove < trim_max * 1.5) {
dout(10) << __func__ << " trim to " << get_trim_to() << " would only trim " << to_remove
<< " > paxos_service_trim_max, limiting to " << trim_max
<< dendl;
return trim_max;
}
const version_t new_trim_max = (trim_max + to_remove) / 2;
const uint64_t trim_max_multiplier = g_conf().get_val<uint64_t>("paxos_service_trim_max_multiplier");
if (trim_max_multiplier) {
return std::min(new_trim_max, trim_max * trim_max_multiplier);
} else {
return new_trim_max;
}
}();
trim_to = get_first_committed() + to_remove;
dout(10) << __func__ << " trimming to " << trim_to << ", " << to_remove << " states" << dendl;
MonitorDBStore::TransactionRef t = paxos.get_pending_transaction();