From: Sage Weil Date: Mon, 17 Sep 2018 17:51:41 +0000 (-0500) Subject: osd/PG: inherit pg history from merge source, if necessary X-Git-Tag: v14.0.1~212^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=e7f4291fe71d782f1269acb1e32345696c3401c5;p=ceph.git osd/PG: inherit pg history from merge source, if necessary Having an accurate(ish) same_interval_since is important for making sure any subsequent PastIntervals we add are consistent with the last_epoch_clean value that the bounds are tested against. Otherwise we might have lec 100 and merge in 150, an interval changes gives us a pi of [150,something) and we fail the bounds check. Signed-off-by: Sage Weil --- diff --git a/src/osd/PG.cc b/src/osd/PG.cc index 046ba1e9366..8cf9f6c8e98 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -2750,13 +2750,23 @@ void PG::merge_from(map& sources, RecoveryCtx *rctx, // make sure we have a meaningful last_epoch_started/clean (if we were a // placeholder) if (info.last_epoch_started == 0) { + // start with (a) source's history, since these PGs *should* have been + // remapped in concert with each other... + info.history = sources.begin()->second->info.history; + // we use the pg_num_dec_last_epoch_clean we got from the caller, which is // the epoch that was clean according to the target pg whe it requested // the mon decrement pg_num. - info.history.last_epoch_started = - info.history.last_epoch_clean = dec_last_epoch_clean; + info.history.last_epoch_clean = dec_last_epoch_clean; + + // use last_epoch_clean value for last_epoch_started, though--we must be + // conservative here to avoid breaking peering, calc_acting, etc. + info.history.last_epoch_started = dec_last_epoch_clean; + info.last_epoch_started = dec_last_epoch_clean; dout(10) << __func__ - << " set last_epoch_started/clean based on past intervals" + << " set last_epoch_{started,clean} to " << dec_last_epoch_clean + << " from pg_num_dec_last_epoch_clean, source pg history was " + << sources.begin()->second->info.history << dendl; }