From 004e7c9283d8422eeb6ca0fd028002b4f7988924 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Thu, 1 Dec 2011 20:46:12 -0800 Subject: [PATCH] osd: add Incomplete peering state Signed-off-by: Sage Weil --- src/osd/PG.cc | 13 +++++++++++-- src/osd/PG.h | 13 ++++++++++++- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/src/osd/PG.cc b/src/osd/PG.cc index 4b74d1b29d636..bcc5db4262ff8 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -4485,8 +4485,7 @@ PG::RecoveryState::GetLog::GetLog(my_context ctx) : // am i broken? if (pg->info.last_update < best.log_tail) { dout(10) << " not contiguous with osd." << newest_update_osd << ", down" << dendl; - /*post_event(...something...); */ -#warning fixme need an event here? + post_event(IsIncomplete()); return; } @@ -4567,6 +4566,16 @@ void PG::RecoveryState::WaitActingChange::exit() { context< RecoveryMachine >().log_exit(state_name, enter_time); } +/*------Incomplete--------*/ +PG::RecoveryState::Incomplete::Incomplete(my_context ctx) : my_base(ctx) +{ + state_name = "Started/Primary/Peering/Incomplete"; + context< RecoveryMachine >().log_enter(state_name); +} +void PG::RecoveryState::Incomplete::exit() { + context< RecoveryMachine >().log_exit(state_name, enter_time); +} + /*------GetMissing--------*/ PG::RecoveryState::GetMissing::GetMissing(my_context ctx) : my_base(ctx) { diff --git a/src/osd/PG.h b/src/osd/PG.h index 0ebf0a6d92d9d..9d916a151983f 100644 --- a/src/osd/PG.h +++ b/src/osd/PG.h @@ -1158,6 +1158,10 @@ public: struct NeedNewMap : boost::statechart::event< NeedNewMap > { NeedNewMap() : boost::statechart::event< NeedNewMap >() {} }; + struct Incomplete; + struct IsIncomplete : boost::statechart::event< IsIncomplete > { + IsIncomplete() : boost::statechart::event< IsIncomplete >() {} + }; struct Primary : boost::statechart::state< Primary, Started, Peering >, NamedState { Primary(my_context ctx); @@ -1167,7 +1171,8 @@ public: boost::statechart::custom_reaction< ActMap >, boost::statechart::custom_reaction< MNotifyRec >, boost::statechart::custom_reaction< AdvMap >, - boost::statechart::transition< NeedNewMap, WaitActingChange > + boost::statechart::transition< NeedNewMap, WaitActingChange >, + boost::statechart::transition< IsIncomplete, Incomplete > > reactions; boost::statechart::result react(const ActMap&); boost::statechart::result react(const AdvMap&); @@ -1183,6 +1188,12 @@ public: boost::statechart::result react(const MLogRec&); void exit(); }; + + struct Incomplete : boost::statechart::state< Incomplete, Primary>, + NamedState { + Incomplete(my_context ctx); + void exit(); + }; struct GetInfo; struct Active; -- 2.39.5