From: Kamoltat Date: Tue, 2 May 2023 14:17:07 +0000 (+0000) Subject: mon/ConnectionTracker.cc: disregard connection scores from mon_rank = -1 X-Git-Tag: testing/wip-pdonnell-testing-20240430.123648-reef-debug~303^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=3196aaec8edfbd06a1b305a6966ad7c03984d88f;p=ceph-ci.git mon/ConnectionTracker.cc: disregard connection scores from mon_rank = -1 There are certain situations where we would come across rank -1 in our MON connection scores; - New MON sends probe message to existing MON, existing MON handle probe message by adding -1 to existing peer_scores. This is not good because we want to implement a connection scores check mechanism where we should not have to take into account the possibility of having rank -1 in our score. Fixes: https://tracker.ceph.com/issues/59564 Signed-off-by: Kamoltat (cherry picked from commit 6ffc70a1b7f3dbe9237c2379c477d7dc4898024f) --- diff --git a/src/mon/ConnectionTracker.cc b/src/mon/ConnectionTracker.cc index 272ad40c274..c87d614f642 100644 --- a/src/mon/ConnectionTracker.cc +++ b/src/mon/ConnectionTracker.cc @@ -62,7 +62,9 @@ void ConnectionTracker::receive_peer_report(const ConnectionTracker& o) ldout(cct, 30) << __func__ << dendl; for (auto& i : o.peer_reports) { const ConnectionReport& report = i.second; - if (i.first == rank) continue; + if (i.first == rank || i.first < 0) { + continue; + } ConnectionReport& existing = *reports(i.first); if (report.epoch > existing.epoch || (report.epoch == existing.epoch && @@ -79,26 +81,32 @@ void ConnectionTracker::receive_peer_report(const ConnectionTracker& o) bool ConnectionTracker::increase_epoch(epoch_t e) { ldout(cct, 30) << __func__ << " to " << e << dendl; - if (e > epoch) { + if (e > epoch && rank >= 0) { my_reports.epoch_version = version = 0; my_reports.epoch = epoch = e; peer_reports[rank] = my_reports; encoding.clear(); return true; } + ldout(cct, 10) << "Either got a report from a rank -1 or our epoch is >= to " + << e << " not increasing our epoch!" << dendl; return false; } void ConnectionTracker::increase_version() { ldout(cct, 30) << __func__ << " to " << version+1 << dendl; - encoding.clear(); - ++version; - my_reports.epoch_version = version; - peer_reports[rank] = my_reports; - if ((version % persist_interval) == 0 ) { - ldout(cct, 30) << version << " % " << persist_interval << " == 0" << dendl; - owner->persist_connectivity_scores(); + if (rank >= 0) { + encoding.clear(); + ++version; + my_reports.epoch_version = version; + peer_reports[rank] = my_reports; + if ((version % persist_interval) == 0 ) { + ldout(cct, 30) << version << " % " << persist_interval << " == 0" << dendl; + owner->persist_connectivity_scores(); + } + } else { + ldout(cct, 10) << "Got a report from a rank -1, not increasing our version!" << dendl; } } @@ -110,6 +118,10 @@ void ConnectionTracker::report_live_connection(int peer_rank, double units_alive lderr(cct) << "Got a report from my own rank, hopefully this is startup weirdness, dropping" << dendl; return; } + if (peer_rank < 0) { + ldout(cct, 10) << "Got a report from a rank -1, not adding that to our report!" << dendl; + return; + } // we need to "auto-initialize" to 1, do shenanigans auto i = my_reports.history.find(peer_rank); if (i == my_reports.history.end()) { @@ -138,6 +150,10 @@ void ConnectionTracker::report_dead_connection(int peer_rank, double units_dead) lderr(cct) << "Got a report from my own rank, hopefully this is startup weirdness, dropping" << dendl; return; } + if (peer_rank < 0) { + ldout(cct, 10) << "Got a report from a rank -1, not adding that to our report!" << dendl; + return; + } // we need to "auto-initialize" to 1, do shenanigans auto i = my_reports.history.find(peer_rank); if (i == my_reports.history.end()) {