]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
osd, mon: Add new pg states recovery_unfound and backfill_unfound
authorDavid Zafman <dzafman@redhat.com>
Mon, 9 Oct 2017 15:19:21 +0000 (08:19 -0700)
committerDavid Zafman <dzafman@redhat.com>
Wed, 18 Oct 2017 18:02:10 +0000 (11:02 -0700)
Signed-off-by: David Zafman <dzafman@redhat.com>
src/mon/PGMap.cc
src/osd/PG.cc
src/osd/PG.h
src/osd/osd_types.cc
src/osd/osd_types.h

index 0b6d3480497e7d4260bf88c68aaa9303b05af373..206983b54f89393c4243a3f088659574eb2d4507 100644 (file)
@@ -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,    {}} },
index 831ea5fbc22971ea03c581c49644586aed6e063e..325290d8ab5eed72deb8c041d8a060b4a6799056 100644 (file)
@@ -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<pg_shard_t>::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);
index ce67cc1d9608152a9bee58002cd3bab30ef4eb7a..40e7c7c3be5e33d85e6f86ab2ecfc257257b7d75 100644 (file)
@@ -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); }
index ceced3cb40b7e1d65b05d378810bef197eb3dddc..5a53342b3afaca1c18efbd59b5c9365d7bb0a9bf 100644 (file)
@@ -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<uint64_t> 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")
index 33583e216393846c15dc5f46b6096a043c7d2646..acb9c89e5bd165ad9bc91b38110818c5e51a3d13 100644 (file)
@@ -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