From 77bc23c3ac684516ffe4d93be91b82cfef41b4a0 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 13 Jan 2015 07:55:16 -0800 Subject: [PATCH 1/2] osd/PG: add 'activating' pg state between peering and active 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 --- src/osd/PG.cc | 5 ++++- src/osd/osd_types.cc | 2 ++ src/osd/osd_types.h | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/osd/PG.cc b/src/osd/PG.cc index 8cc4e4eda3e..e6d9e148d4d 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -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); diff --git a/src/osd/osd_types.cc b/src/osd/osd_types.cc index 55c3d73e850..5fb799cbcff 100644 --- a/src/osd/osd_types.cc +++ b/src/osd/osd_types.cc @@ -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) diff --git a/src/osd/osd_types.h b/src/osd/osd_types.h index 07b88aa6f98..f99dc57e572 100644 --- a/src/osd/osd_types.h +++ b/src/osd/osd_types.h @@ -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); From e2a7b17f2fd8300e6041accbba4496f891a2c32d Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 13 Jan 2015 07:56:36 -0800 Subject: [PATCH 2/2] osd/PG: remove unnecessary publish_stats_to_osd() in all_activated_and_committted() We queue the AllReplicasActivated event, and when that is processed we call on_activated(), which publishes our pg stats. Signed-off-by: Sage Weil --- src/osd/PG.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/src/osd/PG.cc b/src/osd/PG.cc index e6d9e148d4d..4d344958659 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -1855,7 +1855,6 @@ void PG::all_activated_and_committed() state_clear(PG_STATE_CREATING); share_pg_info(); - publish_stats_to_osd(); queue_peering_event( CephPeeringEvtRef(