From e7f4291fe71d782f1269acb1e32345696c3401c5 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 17 Sep 2018 12:51:41 -0500 Subject: [PATCH] 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 --- src/osd/PG.cc | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/osd/PG.cc b/src/osd/PG.cc index 046ba1e9366ec..8cf9f6c8e98d6 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; } -- 2.39.5