]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
PG: last_warm_restart must be set to the current epoch
authorSamuel Just <samuel.just@dreamhost.com>
Wed, 17 Aug 2011 23:24:07 +0000 (16:24 -0700)
committerSamuel Just <samuel.just@dreamhost.com>
Wed, 17 Aug 2011 23:35:53 +0000 (16:35 -0700)
Previously, last_warm_restart did not get set until the
first time the pg was restarted.

Signed-off-by: Samuel Just <samuel.just@dreamhost.com>
src/osd/PG.cc
src/osd/PG.h

index 195465920bfc7c6b205c7caacfff65ebfd5bb6b5..4fa0d169a2fac56d661600d27f9ed533eda60582 100644 (file)
@@ -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<int>& newup, const vector<int>& newacting)
 {
@@ -3509,7 +3514,7 @@ void PG::warm_restart(const OSDMap& lastmap, const vector<int>& newup, const vec
   // -- there was a change! --
   kick();
 
-  last_warm_restart = osdmap.get_epoch();
+  reset_last_warm_restart();
 
   vector<int> 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;
index 8ac768c84c67c4364d662cdee0e734fdfb827f2e..2cf9b9c98e80ca18081e9688db0702e2b8b5cfb2 100644 (file)
@@ -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<int>& newup, const vector<int>& newacting);
+  void reset_last_warm_restart();
                    
   void fulfill_info(int from, const Query &query, 
                    pair<int, Info> &notify_info);