]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/ConnectionTracker.cc: disregard connection scores from mon_rank = -1 55167/head
authorKamoltat <ksirivad@redhat.com>
Tue, 2 May 2023 14:17:07 +0000 (14:17 +0000)
committerKamoltat <ksirivad@redhat.com>
Sat, 13 Jan 2024 01:22:30 +0000 (01:22 +0000)
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 <ksirivad@redhat.com>
(cherry picked from commit 6ffc70a1b7f3dbe9237c2379c477d7dc4898024f)

src/mon/ConnectionTracker.cc

index 272ad40c27461498d45dc7705cbb29231c7dc47e..c87d614f6420fcfd9e4d63cecdab95f20eff58a2 100644 (file)
@@ -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()) {