diff options
author | Patrick Donnelly <pdonnell@redhat.com> | 2021-07-14 12:04:03 -0700 |
---|---|---|
committer | Patrick Donnelly <pdonnell@redhat.com> | 2021-07-29 08:50:15 -0700 |
commit | f1813f69049a00eb4218bb01bc9f86cbad310606 (patch) | |
tree | 212c0eab40ccc347c5a24ac31936f2733e7c6e90 | |
parent | a687ee6e21bdcfaf3e4263c71f94e92a75941e89 (diff) | |
download | ceph-f1813f69049a00eb4218bb01bc9f86cbad310606.tar.gz |
mon: add debugging for trimming methods
Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
(cherry picked from commit 9297690e9a4158e1ba3a1bdea924e86b586a390c)
Conflicts:
src/mon/PaxosService.cc: trivial operator change
-rw-r--r-- | src/mon/MDSMonitor.cc | 7 | ||||
-rw-r--r-- | src/mon/PaxosService.cc | 17 |
2 files changed, 15 insertions, 9 deletions
diff --git a/src/mon/MDSMonitor.cc b/src/mon/MDSMonitor.cc index 7ff5f889e69..994531da181 100644 --- a/src/mon/MDSMonitor.cc +++ b/src/mon/MDSMonitor.cc @@ -273,8 +273,11 @@ version_t MDSMonitor::get_trim_to() const unsigned max = g_conf()->mon_max_mdsmap_epochs; version_t last = get_last_committed(); - if (last - get_first_committed() > max && floor < last - max) - return last - max; + if (last - get_first_committed() > max && floor < last - max) { + floor = last-max; + } + + dout(20) << __func__ << " = " << floor << dendl; return floor; } diff --git a/src/mon/PaxosService.cc b/src/mon/PaxosService.cc index 6b090eb661a..1acadebbea6 100644 --- a/src/mon/PaxosService.cc +++ b/src/mon/PaxosService.cc @@ -372,14 +372,17 @@ void PaxosService::maybe_trim() if (!is_writeable()) return; + const version_t first_committed = get_first_committed(); version_t trim_to = get_trim_to(); - if (trim_to < get_first_committed()) { + dout(20) << __func__ << " " << first_committed << "~" << trim_to << dendl; + + if (trim_to < first_committed) { dout(10) << __func__ << " trim_to " << trim_to << " < first_committed " - << get_first_committed() << dendl; + << first_committed << dendl; return; } - version_t to_remove = trim_to - get_first_committed(); + version_t to_remove = trim_to - first_committed; const version_t trim_min = g_conf().get_val<version_t>("paxos_service_trim_min"); if (trim_min > 0 && to_remove < trim_min) { @@ -388,13 +391,13 @@ void PaxosService::maybe_trim() return; } - to_remove = [to_remove, this] { + to_remove = [to_remove, trim_to, 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 + dout(10) << __func__ << " trim to " << trim_to << " would only trim " << to_remove << " > paxos_service_trim_max, limiting to " << trim_max << dendl; return trim_max; @@ -407,11 +410,11 @@ void PaxosService::maybe_trim() return new_trim_max; } }(); - trim_to = get_first_committed() + to_remove; + trim_to = first_committed + to_remove; dout(10) << __func__ << " trimming to " << trim_to << ", " << to_remove << " states" << dendl; MonitorDBStore::TransactionRef t = paxos->get_pending_transaction(); - trim(t, get_first_committed(), trim_to); + trim(t, first_committed, trim_to); put_first_committed(t, trim_to); cached_first_committed = trim_to; |