From 25a901baf7f5d8130b7ed3d6913608105ccd4de6 Mon Sep 17 00:00:00 2001 From: David Zafman Date: Mon, 9 Oct 2017 08:19:21 -0700 Subject: [PATCH] osd, mon: Add new pg states recovery_unfound and backfill_unfound Signed-off-by: David Zafman (cherry picked from commit 7f8b0ce9e681f727d8217e3ed74a1a3355f364f3) Conflicts: src/osd/PG.h (trivial) src/osd/osd_types.h (trivial) --- src/mon/PGMap.cc | 2 ++ src/osd/PG.cc | 6 ++++-- src/osd/PG.h | 2 ++ src/osd/osd_types.cc | 8 ++++++++ src/osd/osd_types.h | 4 ++-- 5 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/mon/PGMap.cc b/src/mon/PGMap.cc index 6fcc3c0721af..36e1d8dee688 100644 --- a/src/mon/PGMap.cc +++ b/src/mon/PGMap.cc @@ -2663,6 +2663,8 @@ void PGMap::get_health_checks( { PG_STATE_INCOMPLETE, {UNAVAILABLE, {}} }, { PG_STATE_REPAIR, {DAMAGED, {}} }, { PG_STATE_SNAPTRIM_ERROR, {DAMAGED, {}} }, + { PG_STATE_RECOVERY_UNFOUND, {DAMAGED, {}} }, + { PG_STATE_BACKFILL_UNFOUND, {DAMAGED, {}} }, { PG_STATE_BACKFILL_TOOFULL, {DEGRADED_FULL, {}} }, { PG_STATE_RECOVERY_TOOFULL, {DEGRADED_FULL, {}} }, { PG_STATE_DEGRADED, {DEGRADED, {}} }, diff --git a/src/osd/PG.cc b/src/osd/PG.cc index 3a919cdbab8a..b3dd2d9be98d 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -6440,6 +6440,7 @@ PG::RecoveryState::Backfilling::react(const UnfoundBackfill &c) ldout(pg->cct, 10) << "backfill has unfound, can't continue" << dendl; pg->osd->local_reserver.cancel_reservation(pg->info.pgid); + pg->state_set(PG_STATE_BACKFILL_UNFOUND); pg->state_clear(PG_STATE_BACKFILLING); for (set::iterator it = pg->backfill_targets.begin(); @@ -6644,7 +6645,7 @@ void PG::RecoveryState::NotBackfilling::exit() { context< RecoveryMachine >().log_exit(state_name, enter_time); PG *pg = context< RecoveryMachine >().pg; - pg->state_clear(PG_STATE_UNFOUND); + pg->state_clear(PG_STATE_BACKFILL_UNFOUND); utime_t dur = ceph_clock_now() - enter_time; pg->osd->recoverystate_perf->tinc(rs_notbackfilling_latency, dur); } @@ -6663,7 +6664,7 @@ void PG::RecoveryState::NotRecovering::exit() { context< RecoveryMachine >().log_exit(state_name, enter_time); PG *pg = context< RecoveryMachine >().pg; - pg->state_clear(PG_STATE_UNFOUND); + pg->state_clear(PG_STATE_RECOVERY_UNFOUND); utime_t dur = ceph_clock_now() - enter_time; pg->osd->recoverystate_perf->tinc(rs_notrecovering_latency, dur); } @@ -7045,6 +7046,7 @@ PG::RecoveryState::Recovering::react(const UnfoundRecovery &evt) { PG *pg = context< RecoveryMachine >().pg; ldout(pg->cct, 10) << "recovery has unfound, can't continue" << dendl; + pg->state_set(PG_STATE_RECOVERY_UNFOUND); pg->state_clear(PG_STATE_RECOVERING); pg->osd->local_reserver.cancel_reservation(pg->info.pgid); release_reservations(true); diff --git a/src/osd/PG.h b/src/osd/PG.h index 8adb06389940..ccf6d88f9098 100644 --- a/src/osd/PG.h +++ b/src/osd/PG.h @@ -2384,6 +2384,8 @@ protected: bool is_activating() const { return state_test(PG_STATE_ACTIVATING); } bool is_peering() const { return state_test(PG_STATE_PEERING); } bool is_down() const { return state_test(PG_STATE_DOWN); } + bool is_recovery_unfound() const { return state_test(PG_STATE_RECOVERY_UNFOUND); } + bool is_backfill_unfound() const { return state_test(PG_STATE_BACKFILL_UNFOUND); } bool is_incomplete() const { return state_test(PG_STATE_INCOMPLETE); } bool is_clean() const { return state_test(PG_STATE_CLEAN); } bool is_degraded() const { return state_test(PG_STATE_DEGRADED); } diff --git a/src/osd/osd_types.cc b/src/osd/osd_types.cc index b22001af6f00..102844ca7beb 100644 --- a/src/osd/osd_types.cc +++ b/src/osd/osd_types.cc @@ -811,6 +811,10 @@ std::string pg_state_string(int state) oss << "forced_recovery+"; if (state & PG_STATE_DOWN) oss << "down+"; + if (state & PG_STATE_RECOVERY_UNFOUND) + oss << "recovery_unfound+"; + if (state & PG_STATE_BACKFILL_UNFOUND) + oss << "backfill_unfound+"; if (state & PG_STATE_UNDERSIZED) oss << "undersized+"; if (state & PG_STATE_DEGRADED) @@ -862,6 +866,10 @@ boost::optional pg_string_state(const std::string& state) type = PG_STATE_CLEAN; else if (state == "down") type = PG_STATE_DOWN; + else if (state == "recovery_unfound") + type = PG_STATE_RECOVERY_UNFOUND; + else if (state == "backfill_unfound") + type = PG_STATE_BACKFILL_UNFOUND; else if (state == "scrubbing") type = PG_STATE_SCRUBBING; else if (state == "degraded") diff --git a/src/osd/osd_types.h b/src/osd/osd_types.h index a820c8f6bfa7..6fdb6d6d4118 100644 --- a/src/osd/osd_types.h +++ b/src/osd/osd_types.h @@ -971,8 +971,8 @@ inline ostream& operator<<(ostream& out, const osd_stat_t& s) { #define PG_STATE_ACTIVE (1<<1) // i am active. (primary: replicas too) #define PG_STATE_CLEAN (1<<2) // peers are complete, clean of stray replicas. #define PG_STATE_DOWN (1<<4) // a needed replica is down, PG offline -//#define PG_STATE_REPLAY (1<<5) // crashed, waiting for replay -//#define PG_STATE_STRAY (1<<6) // i must notify the primary i exist. +#define PG_STATE_RECOVERY_UNFOUND (1<<5) // recovery stopped due to unfound +#define PG_STATE_BACKFILL_UNFOUND (1<<6) // backfill stopped due to unfound //#define PG_STATE_SPLITTING (1<<7) // i am splitting #define PG_STATE_SCRUBBING (1<<8) // scrubbing //#define PG_STATE_SCRUBQ (1<<9) // queued for scrub -- 2.47.3