From: Greg Farnum Date: Thu, 5 May 2011 21:36:26 +0000 (-0700) Subject: PG: handle MOSDPGLog messages in Active state. X-Git-Tag: v0.28~74^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=6ac5572946337e8e74b5014fc299e0ee10c70d9f;p=ceph.git PG: handle MOSDPGLog messages in Active state. We previously didn't, but we definitely need to as we can go active while waiting on strays to send in logs to recover missing objects. Signed-off-by: Greg Farnum --- diff --git a/src/osd/PG.cc b/src/osd/PG.cc index 37f330f62d147..60bb1b89d3f73 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -569,10 +569,11 @@ void PG::merge_log(ObjectStore::Transaction& t, * TODO: if the missing set becomes very large, this could get expensive. * Instead, we probably want to just iterate over our unfound set. */ -void PG::search_for_missing(const Info &oinfo, const Missing *omissing, +bool PG::search_for_missing(const Info &oinfo, const Missing *omissing, int fromosd) { bool stats_updated = false; + bool found_missing = false; // found items? for (map::iterator p = missing.missing.begin(); @@ -620,12 +621,14 @@ void PG::search_for_missing(const Info &oinfo, const Missing *omissing, else { ml->second.insert(fromosd); } + found_missing = true; } if (stats_updated) { update_stats(); } dout(20) << "search_for_missing missing " << missing.missing << dendl; + return found_missing; } void PG::discover_all_missing(map< int, map > &query_map) @@ -4025,6 +4028,18 @@ PG::RecoveryState::Active::react(const MInfoRec& infoevt) { return discard_event(); } +boost::statechart::result +PG::RecoveryState::Active::react(const MLogRec& logevt) { + dout(10) << "searching osd" << logevt.from + << " log for unfound items" << dendl; + PG *pg = context< RecoveryMachine >().pg; + bool got_missing = pg->search_for_missing(logevt.msg->info, + &pg->missing, logevt.from); + if (got_missing) + pg->osd->queue_for_recovery(pg); + return discard_event(); +} + void PG::RecoveryState::Active::exit() { context< RecoveryMachine >().log_exit(state_name, enter_time); } diff --git a/src/osd/PG.h b/src/osd/PG.h index d1b1637390514..9f9ac9f363e0f 100644 --- a/src/osd/PG.h +++ b/src/osd/PG.h @@ -1088,12 +1088,14 @@ public: boost::statechart::custom_reaction< ActMap >, boost::statechart::custom_reaction< AdvMap >, boost::statechart::custom_reaction< MInfoRec >, - boost::statechart::custom_reaction< MNotifyRec > + boost::statechart::custom_reaction< MNotifyRec >, + boost::statechart::custom_reaction< MLogRec > > reactions; boost::statechart::result react(const ActMap&); boost::statechart::result react(const AdvMap&); boost::statechart::result react(const MInfoRec& infoevt); boost::statechart::result react(const MNotifyRec& notevt); + boost::statechart::result react(const MLogRec& logevt); }; struct ReplicaActive : boost::statechart::state< ReplicaActive, Started >, NamedState { @@ -1303,7 +1305,7 @@ public: bool proc_replica_info(int from, Info &info); bool merge_old_entry(ObjectStore::Transaction& t, Log::Entry& oe); void merge_log(ObjectStore::Transaction& t, Info &oinfo, Log &olog, int from); - void search_for_missing(const Info &oinfo, const Missing *omissing, + bool search_for_missing(const Info &oinfo, const Missing *omissing, int fromosd); void check_for_lost_objects();