]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/PG: add 'activating' pg state between peering and active
authorSage Weil <sage@redhat.com>
Tue, 13 Jan 2015 15:55:16 +0000 (07:55 -0800)
committerSage Weil <sage@redhat.com>
Tue, 13 Jan 2015 15:55:16 +0000 (07:55 -0800)
When peering completes we wait for everybody to commit the PG info before
going active.  The peering state is cleared but active is not set, which
means the admin sees PGs in states like 'inactive', 'remapped', or
other confusing names.

Add an 'activating' state that bridges the gap.

Signed-off-by: Sage Weil <sage@redhat.com>
src/osd/PG.cc
src/osd/osd_types.cc
src/osd/osd_types.h

index 8cc4e4eda3e75a0c362382b0352fddf65d15de69..e6d9e148d4d23ee8edadb5a95749eadf6a647608 100644 (file)
@@ -1685,6 +1685,8 @@ void PG::activate(ObjectStore::Transaction& t,
       state_set(PG_STATE_DEGRADED);
       state_set(PG_STATE_UNDERSIZED);
     }
+
+    state_set(PG_STATE_ACTIVATING);
   }
 }
 
@@ -6469,7 +6471,7 @@ boost::statechart::result PG::RecoveryState::Active::react(const AllReplicasActi
 {
   PG *pg = context< RecoveryMachine >().pg;
   all_replicas_activated = true;
-
+  pg->state_clear(PG_STATE_ACTIVATING);
   pg->state_set(PG_STATE_ACTIVE);
 
   pg->check_local();
@@ -6492,6 +6494,7 @@ void PG::RecoveryState::Active::exit()
 
   pg->backfill_reserved = false;
   pg->backfill_reserving = false;
+  pg->state_clear(PG_STATE_ACTIVATING);
   pg->state_clear(PG_STATE_DEGRADED);
   pg->state_clear(PG_STATE_UNDERSIZED);
   pg->state_clear(PG_STATE_BACKFILL_TOOFULL);
index 55c3d73e85035094ed8ec65aa51ad58a8111cc93..5fb799cbcffa8825feda4a8b5ac8b6fb3792e434 100644 (file)
@@ -700,6 +700,8 @@ std::string pg_state_string(int state)
     oss << "creating+";
   if (state & PG_STATE_ACTIVE)
     oss << "active+";
+  if (state & PG_STATE_ACTIVATING)
+    oss << "activating+";
   if (state & PG_STATE_CLEAN)
     oss << "clean+";
   if (state & PG_STATE_RECOVERY_WAIT)
index 07b88aa6f98971e31f09bed7403e36c6036340f2..f99dc57e5725850cd28402028268a6d2b3933f42 100644 (file)
@@ -766,6 +766,7 @@ inline ostream& operator<<(ostream& out, const osd_stat_t& s) {
 #define PG_STATE_BACKFILL_TOOFULL (1<<21) // backfill can't proceed: too full
 #define PG_STATE_RECOVERY_WAIT (1<<22) // waiting for recovery reservations
 #define PG_STATE_UNDERSIZED    (1<<23) // pg acting < pool size
+#define PG_STATE_ACTIVATING   (1<<24) // pg is peered but not yet active
 
 std::string pg_state_string(int state);