]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/Elector & ConnectionTracker: reset peer_tracker.rank
authorKamoltat <ksirivad@redhat.com>
Fri, 4 Nov 2022 02:02:49 +0000 (02:02 +0000)
committerKamoltat <ksirivad@redhat.com>
Wed, 21 Dec 2022 21:57:18 +0000 (21:57 +0000)
In `notify_clear_peer_state()` we another
mechanism in reseting our `peer_tracker.rank`
to match our own monitor.rank.

This is added so there is a way for us
to recover from a scenrio where `peer_tracker.rank`
is messed up from adjusting the ranks or removing
ranks.

`notifiy_clear_peer_state()` can be triggered
by using the command:

`ceph connection scores reset`

Also in `clear_peer_reports`, besides
reassigning my_reports to an empty object,
we also have to make `my_reports` = `rank`
from `peer_tracker`, such that we don't get
-1 as a rank in my_reports.

Fixes: https://tracker.ceph.com/issues/58049
Signed-off-by: Kamoltat <ksirivad@redhat.com>
(cherry picked from commit 55cf717a3070d10b6b02af33a66d6ad0acbba0f6)

src/mon/ConnectionTracker.h
src/mon/Elector.cc

index f2ae5b123bc1749d40dc8e745b85b71eb890aa1e..4196bca279341a3ee0793e02b9a2953b7b0a3b65 100644 (file)
@@ -152,6 +152,7 @@ class ConnectionTracker {
     encoding.clear();
     peer_reports.clear();
     my_reports = ConnectionReport();
+    my_reports.rank = rank;
   }
 
  public:
@@ -180,6 +181,10 @@ class ConnectionTracker {
     my_reports = o.my_reports;
   }
   void notify_reset() { clear_peer_reports(); }
+  void set_rank(int new_rank) {
+    rank = new_rank;
+    my_reports.rank = rank;
+  }
   void notify_rank_changed(int new_rank);
   void notify_rank_removed(int rank_removed, int new_rank);
   friend std::ostream& operator<<(std::ostream& o, const ConnectionTracker& c);
index af1109ae8d2691792a1347d7c058e18f89822cf6..c725a38e9ba6cb4a3d297831394c3513b8239a22 100644 (file)
@@ -719,8 +719,11 @@ void Elector::start_participating()
 
 void Elector::notify_clear_peer_state()
 {
-  dout(10) << __func__ << dendl; 
+  dout(10) << __func__ << dendl;
+  dout(20) << " peer_tracker before: " << peer_tracker << dendl;
   peer_tracker.notify_reset();
+  peer_tracker.set_rank(mon->rank);
+  dout(20) << " peer_tracker after: " << peer_tracker << dendl;
 }
 
 void Elector::notify_rank_changed(int new_rank)