* 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<sobject_t,Missing::item>::iterator p = missing.missing.begin();
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<pg_t,PG::Query> > &query_map)
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);
}
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 {
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();