from, oinfo, omissing, ctx->handle);
if (found_missing && num_unfound_before != missing_loc.num_unfound())
publish_stats_to_osd();
+ // avoid doing this if the peer is empty. This is abit of paranoia
+ // to avoid doing something rash if add_source_info() above
+ // incorrectly decided we found something new. (if the peer has
+ // last_update=0'0 that's impossible.)
if (found_missing &&
(get_osdmap()->get_features(CEPH_ENTITY_TYPE_OSD, NULL) &
- CEPH_FEATURE_OSD_ERASURE_CODES)) {
+ CEPH_FEATURE_OSD_ERASURE_CODES) &&
+ oinfo.last_update != eversion_t()) {
pg_info_t tinfo(oinfo);
tinfo.pgid.shard = pg_whoami.shard;
(*(ctx->info_map))[from.osd].push_back(
if (p->second.is_delete()) {
ldout(pg->cct, 10) << __func__ << " " << soid
<< " delete, ignoring source" << dendl;
- found_missing = true;
continue;
}
if (oinfo.last_update < need) {
osd->send_message_osd_cluster(mlog, con.get());
}
+void PG::fulfill_query(const MQuery& query, RecoveryCtx *rctx)
+{
+ if (query.query.type == pg_query_t::INFO) {
+ pair<pg_shard_t, pg_info_t> notify_info;
+ update_history(query.query.history);
+ fulfill_info(query.from, query.query, notify_info);
+ rctx->send_notify(
+ notify_info.first,
+ pg_notify_t(
+ notify_info.first.shard, pg_whoami.shard,
+ query.query_epoch,
+ get_osdmap()->get_epoch(),
+ notify_info.second),
+ past_intervals);
+ } else {
+ update_history(query.query.history);
+ fulfill_log(query.from, query.query, query.query_epoch);
+ }
+}
+
void PG::check_full_transition(OSDMapRef lastmap, OSDMapRef osdmap)
{
bool changed = false;
dout(20) << "new interval newup " << newup
<< " newacting " << newacting << dendl;
return true;
- } else {
- return false;
}
+ if (!lastmap->is_up(osd->whoami) && osdmap->is_up(osd->whoami)) {
+ dout(10) << __func__ << " osd transitioned from down -> up" << dendl;
+ return true;
+ }
+ return false;
}
bool PG::old_peering_msg(epoch_t reply_epoch, epoch_t query_epoch)
return discard_event();
}
-boost::statechart::result PG::RecoveryState::ReplicaActive::react(const MQuery& query)
+boost::statechart::result PG::RecoveryState::ReplicaActive::react(
+ const MQuery& query)
{
PG *pg = context< RecoveryMachine >().pg;
- if (query.query.type == pg_query_t::MISSING) {
- pg->update_history(query.query.history);
- pg->fulfill_log(query.from, query.query, query.query_epoch);
- } // else: from prior to activation, safe to ignore
+ pg->fulfill_query(query, context<RecoveryMachine>().get_recovery_ctx());
return discard_event();
}
boost::statechart::result PG::RecoveryState::Stray::react(const MQuery& query)
{
PG *pg = context< RecoveryMachine >().pg;
- if (query.query.type == pg_query_t::INFO) {
- pair<pg_shard_t, pg_info_t> notify_info;
- pg->update_history(query.query.history);
- pg->fulfill_info(query.from, query.query, notify_info);
- context< RecoveryMachine >().send_notify(
- notify_info.first,
- pg_notify_t(
- notify_info.first.shard, pg->pg_whoami.shard,
- query.query_epoch,
- pg->get_osdmap()->get_epoch(),
- notify_info.second),
- pg->past_intervals);
- } else {
- pg->fulfill_log(query.from, query.query, query.query_epoch);
- }
+ pg->fulfill_query(query, context<RecoveryMachine>().get_recovery_ctx());
return discard_event();
}