From: Samuel Just Date: Sat, 10 Sep 2011 04:39:27 +0000 (-0700) Subject: PG: generate backlog when confronted with corrupt log X-Git-Tag: v0.35~41 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=405abf5abec64ee3cb7d4b448736b6ef92dfd6c2;p=ceph.git PG: generate backlog when confronted with corrupt log 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 --- diff --git a/src/osd/PG.cc b/src/osd/PG.cc index 42d98bef16133..e8c608fede7c1 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -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(); diff --git a/src/osd/PG.h b/src/osd/PG.h index cdeb71c1fc0e8..c7939adfef3b1 100644 --- a/src/osd/PG.h +++ b/src/osd/PG.h @@ -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 {