]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
mon/ConnectionTracker.cc: Improve notify_rank_removed()
authorKamoltat <ksirivad@redhat.com>
Wed, 2 Nov 2022 01:46:14 +0000 (01:46 +0000)
committerKamoltat <ksirivad@redhat.com>
Wed, 21 Dec 2022 21:57:18 +0000 (21:57 +0000)
commit96f402d1d376be562b44d4224c2218f1750c6441
tree34c6fbb6dba6711923cdaccbdc85d3e52c9b6930
parent245c5beac5327968f9c316d2eea4c5505dec605c
mon/ConnectionTracker.cc: Improve notify_rank_removed()

PROBLEM:

In `ConnectionTracker::receive_peer_report`
we loop through ranks which is bad when
there is `notify_rank_removed` before this and
the ranks are not adjusted yet. When we rely
on the rank in certain scenarios, we end up
with extra peer_report copy which we don't
want.

SOLUTION:

In `ConnectionTracker::receive_peer_report`
instead of passing `report.rank` in the function
`ConnectionTracker::reports`, we pass `i.first`
instead so that trim old ranks properly.

We also added a assert in notify_rank_removed(),
comparing expected rank provided by the monmap
against the rank that we adjust ourself to as
a sanity check.

We edited test/mon/test_election.cc
to reflect the changes made in notify_rank_removed().

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

Conflicts:
src/mon/Elector.cc - trivial fix
src/mon/Elector.h - trivial fix
src/mon/ConnectionTracker.cc
src/mon/ConnectionTracker.h
src/mon/Elector.cc
src/mon/Elector.h
src/test/mon/test_election.cc