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 &&
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;
}
}
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()) {
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()) {