From 7f8b0ce9e681f727d8217e3ed74a1a3355f364f3 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 --- 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 0b6d3480497..206983b54f8 100644 --- a/src/mon/PGMap.cc +++ b/src/mon/PGMap.cc @@ -2134,6 +2134,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 831ea5fbc22..325290d8ab5 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -6365,6 +6365,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(); @@ -6567,7 +6568,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); } @@ -6586,7 +6587,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); } @@ -6966,6 +6967,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 ce67cc1d960..40e7c7c3be5 100644 --- a/src/osd/PG.h +++ b/src/osd/PG.h @@ -2613,6 +2613,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 ceced3cb40b..5a53342b3af 100644 --- a/src/osd/osd_types.cc +++ b/src/osd/osd_types.cc @@ -811,6 +811,10 @@ std::string pg_state_string(uint64_t 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 33583e21639..acb9c89e5bd 100644 --- a/src/osd/osd_types.h +++ b/src/osd/osd_types.h @@ -978,8 +978,8 @@ inline ostream& operator<<(ostream& out, const osd_stat_t& s) { #define PG_STATE_ACTIVE (1ULL << 1) // i am active. (primary: replicas too) #define PG_STATE_CLEAN (1ULL << 2) // peers are complete, clean of stray replicas. #define PG_STATE_DOWN (1ULL << 4) // a needed replica is down, PG offline -//#define PG_STATE_REPLAY (1ULL << 5) // crashed, waiting for replay -//#define PG_STATE_STRAY (1ULL << 6) // i must notify the primary i exist. +#define PG_STATE_RECOVERY_UNFOUND (1ULL << 5) // recovery stopped due to unfound +#define PG_STATE_BACKFILL_UNFOUND (1ULL << 6) // backfill stopped due to unfound //#define PG_STATE_SPLITTING (1ULL << 7) // i am splitting #define PG_STATE_SCRUBBING (1ULL << 8) // scrubbing //#define PG_STATE_SCRUBQ (1ULL << 9) // queued for scrub -- 2.39.5