pg->info.stats = infoevt.info.stats;
pg->info.hit_set = infoevt.info.hit_set;
}
-
+
assert(infoevt.info.last_update == pg->info.last_update);
assert(pg->pg_log.get_head() == pg->info.last_update);
return forward_event();
}
+boost::statechart::result PG::RecoveryState::Down::react(const MNotifyRec& infoevt)
+{
+ PG *pg = context< RecoveryMachine >().pg;
+
+ assert(pg->is_primary());
+ epoch_t old_start = pg->info.history.last_epoch_started;
+ if (!pg->peer_info.count(infoevt.from) &&
+ pg->get_osdmap()->has_been_up_since(infoevt.from.osd, infoevt.notify.epoch_sent)) {
+ pg->update_history(infoevt.notify.info.history);
+ }
+ // if we got something new to make pg escape down state
+ if (pg->info.history.last_epoch_started > old_start) {
+ ldout(pg->cct, 10) << " last_epoch_started moved forward, re-enter getinfo" << dendl;
+ pg->state_clear(PG_STATE_DOWN);
+ pg->state_set(PG_STATE_PEERING);
+ return transit< GetInfo >();
+ }
+
+ return discard_event();
+}
+
+
/*------Incomplete--------*/
PG::RecoveryState::Incomplete::Incomplete(my_context ctx)
: my_base(ctx),
struct Down : boost::statechart::state< Down, Peering>, NamedState {
explicit Down(my_context ctx);
typedef boost::mpl::list <
- boost::statechart::custom_reaction< QueryState >
+ boost::statechart::custom_reaction< QueryState >,
+ boost::statechart::custom_reaction< MNotifyRec >
> reactions;
- boost::statechart::result react(const QueryState& infoevt);
+ boost::statechart::result react(const QueryState& q);
+ boost::statechart::result react(const MNotifyRec& infoevt);
void exit();
};
explicit Incomplete(my_context ctx);
boost::statechart::result react(const AdvMap &advmap);
boost::statechart::result react(const MNotifyRec& infoevt);
- boost::statechart::result react(const QueryState& infoevt);
+ boost::statechart::result react(const QueryState& q);
void exit();
};
(*could_have_gone_active)(old_acting_shards)) {
if (out)
*out << __func__ << " " << i
- << ": not rw,"
<< " up_thru " << lastmap->get_up_thru(i.primary)
<< " up_from " << lastmap->get_up_from(i.primary)
- << " last_epoch_clean " << last_epoch_clean
- << std::endl;
+ << " last_epoch_clean " << last_epoch_clean;
if (lastmap->get_up_thru(i.primary) >= i.first &&
lastmap->get_up_from(i.primary) <= i.first) {
i.maybe_went_rw = true;
if (out)
- *out << __func__ << " " << i
+ *out << " " << i
<< " : primary up " << lastmap->get_up_from(i.primary)
<< "-" << lastmap->get_up_thru(i.primary)
<< " includes interval"
- << std::endl;
+ << std::endl;
} else if (last_epoch_clean >= i.first &&
last_epoch_clean <= i.last) {
// If the last_epoch_clean is included in this interval, then
// last_epoch_clean timing.
i.maybe_went_rw = true;
if (out)
- *out << __func__ << " " << i
+ *out << " " << i
<< " : includes last_epoch_clean " << last_epoch_clean
<< " and presumed to have been rw"
<< std::endl;
} else {
i.maybe_went_rw = false;
if (out)
- *out << __func__ << " " << i
+ *out << " " << i
<< " : primary up " << lastmap->get_up_from(i.primary)
<< "-" << lastmap->get_up_thru(i.primary)
<< " does not include interval"
- << std::endl;
+ << std::endl;
}
} else {
i.maybe_went_rw = false;