Skip to content

Commit

Permalink
osd: PeeringState: fix selection order in calc_replicated_acting_stretch
Browse files Browse the repository at this point in the history
We were previously mis-ordering these to *de*prioritize the existing acting set. That is bad!

We generate OSD candidates from the acting set and strays, and push
them into the candidates list as a tuple of <<!in_acting,pg_info.last_update>,osd_id>.

Then we sort the list. Then we go through the list from front to back and
push_back entries into the appropriate ancestor lists.

And then we pop_back() off the lists to select the acting set.
Which of course turns our nice careful order backwards! So don't do that.

Fixes: https://tracker.ceph.com/issues/53824

Signed-off-by: Greg Farnum <gfarnum@redhat.com>
  • Loading branch information
gregsfortytwo committed Jan 11, 2022
1 parent 310e8f5 commit 0af5eb6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/osd/PeeringState.cc
Expand Up @@ -1854,8 +1854,8 @@ class bucket_candidates_t {
}
osd_id_t pop_osd() {
ceph_assert(!is_empty());
auto ret = osds.back();
osds.pop_back();
auto ret = osds.front();
osds.pop_front();
return ret.second;
}

Expand All @@ -1864,7 +1864,7 @@ class bucket_candidates_t {

osd_ord_t get_ord() const {
return osds.empty() ? std::make_tuple(false, eversion_t())
: osds.back().first;
: osds.front().first;
}

bool is_empty() const { return osds.empty(); }
Expand Down

0 comments on commit 0af5eb6

Please sign in to comment.