From e1d57730ddfc92b17562080b10bc22fceb86539a Mon Sep 17 00:00:00 2001 From: Guang Yang Date: Mon, 29 Sep 2014 08:21:10 +0000 Subject: [PATCH] PG::actingset should be used when checking the number of acting OSDs for a given PG. Signed-off-by: Guang Yang (cherry picked from commit 19be358322be48fafa17b28054619a8b5e7d403b) Conflicts: src/osd/PG.cc PG::get_backfill_priority() doesn't exist in firefly Variation in code related to no "undersized" state in firefly Fixes: #11454 --- src/osd/PG.cc | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/osd/PG.cc b/src/osd/PG.cc index ad5cd89fcee32..60567d4a803ca 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -1659,7 +1659,7 @@ void PG::activate(ObjectStore::Transaction& t, } // degraded? - if (get_osdmap()->get_pg_size(info.pgid.pgid) > acting.size()) + if (get_osdmap()->get_pg_size(info.pgid.pgid) > actingset.size()) state_set(PG_STATE_DEGRADED); } @@ -6404,13 +6404,11 @@ boost::statechart::result PG::RecoveryState::Active::react(const AdvMap& advmap) pg->dirty_big_info = true; } - for (vector::iterator p = pg->want_acting.begin(); - p != pg->want_acting.end(); ++p) { - if (!advmap.osdmap->is_up(*p)) { - assert((std::find(pg->acting.begin(), pg->acting.end(), *p) != - pg->acting.end()) || - (std::find(pg->up.begin(), pg->up.end(), *p) != - pg->up.end())); + for (size_t i = 0; i < pg->want_acting.size(); i++) { + int osd = pg->want_acting[i]; + if (!advmap.osdmap->is_up(osd)) { + pg_shard_t osd_with_shard(osd, shard_id_t(i)); + assert(pg->is_acting(osd_with_shard) || pg->is_up(osd_with_shard)); } } @@ -6418,7 +6416,7 @@ boost::statechart::result PG::RecoveryState::Active::react(const AdvMap& advmap) * this does not matter) */ if (advmap.lastmap->get_pg_size(pg->info.pgid.pgid) != pg->get_osdmap()->get_pg_size(pg->info.pgid.pgid)) { - if (pg->get_osdmap()->get_pg_size(pg->info.pgid.pgid) <= pg->acting.size()) + if (pg->get_osdmap()->get_pg_size(pg->info.pgid.pgid) <= pg->actingset.size()) pg->state_clear(PG_STATE_DEGRADED); else pg->state_set(PG_STATE_DEGRADED); -- 2.39.5