]> 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>
Fri, 9 Dec 2022 15:43:45 +0000 (15:43 +0000)
commit72d1f5839a5cc99be0c74085e418d1bbbaabe76c
tree122e7664c5d9f6ed56eec4d6cf3f9fc631c06a91
parenta781ff788b43fc7a993cb0b2c2ca51509b0680d5
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>
src/mon/ConnectionTracker.cc
src/mon/ConnectionTracker.h
src/mon/Elector.cc
src/mon/Elector.h
src/test/mon/test_election.cc