mirror of
https://github.com/ceph/ceph
synced 2025-02-22 10:37:15 +00:00
osd: Base pg degraded state on num_degraded_objects
Signed-off-by: David Zafman <dzafman@redhat.com>
This commit is contained in:
parent
e1075f1073
commit
5ffde0002f
@ -1885,17 +1885,13 @@ void PG::activate(ObjectStore::Transaction& t,
|
||||
|
||||
build_might_have_unfound();
|
||||
|
||||
// XXX: Has _update_calc_stats() run? If so, base on num_objects_degraded?
|
||||
state_set(PG_STATE_DEGRADED);
|
||||
if (have_unfound())
|
||||
discover_all_missing(query_map);
|
||||
}
|
||||
|
||||
// degraded?
|
||||
// num_objects_degraded if calculated should reflect this too, unless no
|
||||
// missing and we are about to go clean.
|
||||
if (get_osdmap()->get_pg_size(info.pgid.pgid) > actingset.size()) {
|
||||
state_set(PG_STATE_DEGRADED);
|
||||
state_set(PG_STATE_UNDERSIZED);
|
||||
}
|
||||
|
||||
@ -2018,6 +2014,11 @@ void PG::all_activated_and_committed()
|
||||
assert(!actingbackfill.empty());
|
||||
assert(blocked_by.empty());
|
||||
|
||||
// Degraded?
|
||||
_update_calc_stats();
|
||||
if (info.stats.stats.sum.num_objects_degraded)
|
||||
state_set(PG_STATE_DEGRADED);
|
||||
|
||||
queue_peering_event(
|
||||
PGPeeringEventRef(
|
||||
std::make_shared<PGPeeringEvent>(
|
||||
@ -2692,7 +2693,7 @@ void PG::_update_calc_stats()
|
||||
info.stats.stats.sum.num_objects_degraded = 0;
|
||||
info.stats.stats.sum.num_objects_unfound = 0;
|
||||
info.stats.stats.sum.num_objects_misplaced = 0;
|
||||
if (!is_clean() && is_peered()) {
|
||||
if (!is_clean() && (is_peered() || is_activating())) {
|
||||
dout(20) << __func__ << " not clean" << dendl;
|
||||
|
||||
assert(!actingbackfill.empty());
|
||||
@ -7081,6 +7082,8 @@ PG::RecoveryState::Recovering::react(const RequestBackfill &evt)
|
||||
pg->state_clear(PG_STATE_FORCED_RECOVERY);
|
||||
release_reservations();
|
||||
pg->osd->local_reserver.cancel_reservation(pg->info.pgid);
|
||||
// XXX: Is this needed?
|
||||
pg->publish_stats_to_osd();
|
||||
return transit<WaitLocalBackfillReserved>();
|
||||
}
|
||||
|
||||
@ -7363,23 +7366,26 @@ boost::statechart::result PG::RecoveryState::Active::react(const AdvMap& advmap)
|
||||
}
|
||||
|
||||
bool need_publish = false;
|
||||
pg->_update_calc_stats(); // Too bad this is called again from publish_stats_to_osd()
|
||||
int64_t degraded = pg->info.stats.stats.sum.num_objects_degraded;
|
||||
if (!pg->state_test(PG_STATE_DEGRADED) && degraded) {
|
||||
need_publish = true;
|
||||
pg->state_set(PG_STATE_DEGRADED);
|
||||
} else if (pg->state_test(PG_STATE_DEGRADED) && !degraded) {
|
||||
need_publish = true;
|
||||
pg->state_clear(PG_STATE_DEGRADED);
|
||||
}
|
||||
|
||||
/* Check for changes in pool size (if the acting set changed as a result,
|
||||
* 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->actingset.size()) {
|
||||
pg->state_clear(PG_STATE_UNDERSIZED);
|
||||
// XXX: Base this on num_objects_degraded instead?
|
||||
if (pg->needs_recovery()) {
|
||||
pg->state_set(PG_STATE_DEGRADED);
|
||||
} else {
|
||||
pg->state_clear(PG_STATE_DEGRADED);
|
||||
}
|
||||
} else {
|
||||
pg->state_set(PG_STATE_UNDERSIZED);
|
||||
pg->state_set(PG_STATE_DEGRADED);
|
||||
}
|
||||
need_publish = true; // degraded may have changed
|
||||
need_publish = true; // undersized may have changed
|
||||
}
|
||||
|
||||
// if we haven't reported our PG stats in a long time, do so now.
|
||||
|
Loading…
Reference in New Issue
Block a user