diff options
Diffstat (limited to '')
-rw-r--r-- | src/mon/ConnectionTracker.cc | 34 |
1 files changed, 25 insertions, 9 deletions
diff --git a/src/mon/ConnectionTracker.cc b/src/mon/ConnectionTracker.cc index 272ad40c2..c87d614f6 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()) { |