]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
PG: generate backlog when confronted with corrupt log
authorSamuel Just <samuel.just@dreamhost.com>
Sat, 10 Sep 2011 04:39:27 +0000 (21:39 -0700)
committerSage Weil <sage.weil@dreamhost.com>
Sat, 10 Sep 2011 04:39:44 +0000 (21:39 -0700)
Currently we throw out the log and start up anyway.  With this change, we
would throw out the log, generate a fresh backlog, and then start up.
That may not be the best possible thing, but it's better than what we
currently do.  Indirectly fixes #1502.

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

index 42d98bef16133572500f99a0096c9cdcb913bc57..e8c608fede7c1c4eddd93ea598eac4b008b9c862 100644 (file)
@@ -2478,6 +2478,12 @@ void PG::read_state(ObjectStore *store)
     t.touch(coll_t::META_COLL, log_oid);
     write_info(t);
     store->apply_transaction(t);
+
+    // Generate a backlog
+    osd->queue_generate_backlog(this);
+    while (!info.log_backlog)
+      wait(); // See RecoverState::Initial, kick() is called in 
+              // the BacklogComplete callback
   }
 
   // log any weirdness
@@ -3949,6 +3955,14 @@ PG::RecoveryState::Initial::react(const MLogRec& i) {
   return transit< Stray >();
 }
 
+boost::statechart::result
+PG::RecoveryState::Initial::react(const BacklogComplete&) {
+  PG *pg = context< RecoveryMachine >().pg;
+  pg->kick(); // See read_state, wakes up thread waiting on backlog for
+              // corrupt log
+  return discard_event();
+}
+
 void PG::RecoveryState::Initial::exit() {
   PG *pg = context< RecoveryMachine >().pg;
   pg->reset_last_warm_restart();
index cdeb71c1fc0e8a54f78436334975911905af87cb..c7939adfef3b11e8ad8801a472cf80210b0920f1 100644 (file)
@@ -1041,12 +1041,14 @@ public:
        boost::statechart::custom_reaction< MNotifyRec >,
        boost::statechart::custom_reaction< MInfoRec >,
        boost::statechart::custom_reaction< MLogRec >,
+       boost::statechart::custom_reaction< BacklogComplete >,
        boost::statechart::transition< boost::statechart::event_base, Crashed >
        > reactions;
 
       boost::statechart::result react(const MNotifyRec&);
       boost::statechart::result react(const MInfoRec&);
       boost::statechart::result react(const MLogRec&);
+      boost::statechart::result react(const BacklogComplete&);
     };
 
     struct Reset : boost::statechart::state< Reset, RecoveryMachine >, NamedState {