From: Samuel Just Date: Wed, 17 Aug 2011 23:24:07 +0000 (-0700) Subject: PG: last_warm_restart must be set to the current epoch X-Git-Tag: v0.34~60 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=a88c1790ffb7b708b334a6d9a1deacc300e933be;p=ceph.git PG: last_warm_restart must be set to the current epoch Previously, last_warm_restart did not get set until the first time the pg was restarted. Signed-off-by: Samuel Just --- diff --git a/src/osd/PG.cc b/src/osd/PG.cc index 195465920bfc..4fa0d169a2fa 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -3501,6 +3501,11 @@ bool PG::old_peering_msg(const epoch_t &msg_epoch) return (last_warm_restart > msg_epoch); } +void PG::reset_last_warm_restart() { + const OSDMap &osdmap = *osd->osdmap; + last_warm_restart = osdmap.get_epoch(); +} + /* Called before initializing peering during advance_map */ void PG::warm_restart(const OSDMap& lastmap, const vector& newup, const vector& newacting) { @@ -3509,7 +3514,7 @@ void PG::warm_restart(const OSDMap& lastmap, const vector& newup, const vec // -- there was a change! -- kick(); - last_warm_restart = osdmap.get_epoch(); + reset_last_warm_restart(); vector oldacting, oldup; int oldrole = get_role(); @@ -3893,6 +3898,13 @@ PG::RecoveryState::Initial::Initial(my_context ctx) : my_base(ctx) { context< RecoveryMachine >().log_enter(state_name); } +boost::statechart::result +PG::RecoveryState::Initial::react(const Initialize&) { + PG *pg = context< RecoveryMachine >().pg; + pg->reset_last_warm_restart(); + return transit< Started >(); +} + boost::statechart::result PG::RecoveryState::Initial::react(const MNotifyRec& notify) { PG *pg = context< RecoveryMachine >().pg; diff --git a/src/osd/PG.h b/src/osd/PG.h index 8ac768c84c67..2cf9b9c98e80 100644 --- a/src/osd/PG.h +++ b/src/osd/PG.h @@ -1019,8 +1019,8 @@ public: void exit(); typedef boost::mpl::list < - boost::statechart::transition< Initialize, Started >, boost::statechart::transition< Load, Reset >, + boost::statechart::custom_reaction< Initialize >, boost::statechart::custom_reaction< MNotifyRec >, boost::statechart::custom_reaction< MInfoRec >, boost::statechart::custom_reaction< MLogRec >, @@ -1030,6 +1030,7 @@ public: boost::statechart::result react(const MNotifyRec&); boost::statechart::result react(const MInfoRec&); boost::statechart::result react(const MLogRec&); + boost::statechart::result react(const Initialize&); }; struct Reset : boost::statechart::state< Reset, RecoveryMachine >, NamedState { @@ -1577,6 +1578,7 @@ public: void share_pg_log(const eversion_t &oldver); void warm_restart(const OSDMap& lastmap, const vector& newup, const vector& newacting); + void reset_last_warm_restart(); void fulfill_info(int from, const Query &query, pair ¬ify_info);