]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
PG: set DEGRADED in Active AdvMap handler based on pool size
authorSamuel Just <sam.just@inktank.com>
Mon, 7 Jan 2013 23:02:34 +0000 (15:02 -0800)
committerSamuel Just <sam.just@inktank.com>
Mon, 7 Jan 2013 23:16:09 +0000 (15:16 -0800)
Otherwise, if the acting set does not change, the pg might
not show up as degraded if the pool size now exceeds the
acting set size.

Signed-off-by: Samuel Just <sam.just@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>
src/osd/PG.cc

index fc331b5482b87898cb97ae3c7185eda81542fedb..6dcd23cb939099ef0e3ac2047118b8f141906bca 100644 (file)
@@ -2204,7 +2204,7 @@ void PG::update_stats()
     unsigned target = MAX(get_osdmap()->get_pg_size(info.pgid), acting.size());
     pg_stats_stable.stats.calc_copies(target);
     pg_stats_stable.stats.sum.num_objects_degraded = 0;
-    if (!is_clean() && is_active()) {
+    if ((is_degraded() || !is_clean()) && is_active()) {
       // NOTE: we only generate copies, degraded, unfound values for
       // the summation, not individual stat categories.
       uint64_t num_objects = pg_stats_stable.stats.sum.num_objects;
@@ -5904,6 +5904,20 @@ boost::statechart::result PG::RecoveryState::Active::react(const AdvMap& advmap)
              pg->up.end()));
     }
   }
+
+  /* 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) !=
+      pg->get_osdmap()->get_pg_size(pg->info.pgid)) {
+    unsigned active = pg->acting.size();
+    if (pg->backfill_target != -1)
+      --active;
+    if (pg->get_osdmap()->get_pg_size(pg->info.pgid) <= active)
+      pg->state_clear(PG_STATE_DEGRADED);
+    else
+      pg->state_set(PG_STATE_DEGRADED);
+    pg->update_stats(); // degraded may have changed
+  }
   return forward_event();
 }