Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reef: mon/ConnectionTracker.cc: disregard connection scores from mon_rank = -1 #55167

Merged
merged 1 commit into from
Jan 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
34 changes: 25 additions & 9 deletions src/mon/ConnectionTracker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 &&
Expand All @@ -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;
}
}

Expand All @@ -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()) {
Expand Down Expand Up @@ -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()) {
Expand Down