From 932e4787835f67d7d776e093777488db881f7597 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Wed, 2 Jul 2014 09:10:23 -0700 Subject: [PATCH] mon: track stuck undersized Signed-off-by: Sage Weil --- src/mon/PGMap.cc | 5 +++++ src/mon/PGMap.h | 1 + src/mon/PGMonitor.cc | 17 +++++++++++++++++ 3 files changed, 23 insertions(+) diff --git a/src/mon/PGMap.cc b/src/mon/PGMap.cc index fd918c952ebbb..b7a0a4e9ef770 100644 --- a/src/mon/PGMap.cc +++ b/src/mon/PGMap.cc @@ -776,6 +776,11 @@ void PGMap::get_stuck_stats(PGMap::StuckPG type, utime_t cutoff, continue; val = i->second.last_undegraded; break; + case STUCK_UNDERSIZED: + if ((i->second.state & PG_STATE_UNDERSIZED) == 0) + continue; + val = i->second.last_fullsized; + break; case STUCK_STALE: if ((i->second.state & PG_STATE_STALE) == 0) continue; diff --git a/src/mon/PGMap.h b/src/mon/PGMap.h index 17ae221e8a9ef..7b4eb6ed66695 100644 --- a/src/mon/PGMap.h +++ b/src/mon/PGMap.h @@ -186,6 +186,7 @@ public: enum StuckPG { STUCK_INACTIVE, STUCK_UNCLEAN, + STUCK_UNDERSIZED, STUCK_DEGRADED, STUCK_STALE, STUCK_NONE diff --git a/src/mon/PGMonitor.cc b/src/mon/PGMonitor.cc index ec24915d6f538..ca8142dd500b4 100644 --- a/src/mon/PGMonitor.cc +++ b/src/mon/PGMonitor.cc @@ -1794,6 +1794,10 @@ static void note_stuck_detail(enum PGMap::StuckPG what, since = p->second.last_undegraded; whatname = "degraded"; break; + case PGMap::STUCK_UNDERSIZED: + since = p->second.last_fullsized; + whatname = "undersized"; + break; case PGMap::STUCK_STALE: since = p->second.last_unstale; whatname = "stale"; @@ -1845,6 +1849,8 @@ void PGMonitor::get_health(list >& summary, note["stale"] += p->second; if (p->first & PG_STATE_DOWN) note["down"] += p->second; + if (p->first & PG_STATE_UNDERSIZED) + note["undersized"] += p->second; if (p->first & PG_STATE_DEGRADED) note["degraded"] += p->second; if (p->first & PG_STATE_INCONSISTENT) @@ -1889,6 +1895,14 @@ void PGMonitor::get_health(list >& summary, } stuck_pgs.clear(); + pg_map.get_stuck_stats(PGMap::STUCK_UNDERSIZED, cutoff, stuck_pgs); + if (!stuck_pgs.empty()) { + note["stuck undersized"] = stuck_pgs.size(); + if (detail) + note_stuck_detail(PGMap::STUCK_UNDERSIZED, stuck_pgs, detail); + } + stuck_pgs.clear(); + pg_map.get_stuck_stats(PGMap::STUCK_DEGRADED, cutoff, stuck_pgs); if (!stuck_pgs.empty()) { note["stuck degraded"] = stuck_pgs.size(); @@ -1916,6 +1930,7 @@ void PGMonitor::get_health(list >& summary, ++p) { if ((p->second.state & (PG_STATE_STALE | PG_STATE_DOWN | + PG_STATE_UNDERSIZED | PG_STATE_DEGRADED | PG_STATE_INCONSISTENT | PG_STATE_PEERING | @@ -2125,6 +2140,8 @@ int PGMonitor::dump_stuck_pg_stats(stringstream &ds, stuck_type = PGMap::STUCK_INACTIVE; else if (type == "unclean") stuck_type = PGMap::STUCK_UNCLEAN; + else if (type == "undersized") + stuck_type = PGMap::STUCK_UNDERSIZED; else if (type == "degraded") stuck_type = PGMap::STUCK_DEGRADED; else if (type == "stale") -- 2.39.5