]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/PG: inherit pg history from merge source, if necessary
authorSage Weil <sage@redhat.com>
Mon, 17 Sep 2018 17:51:41 +0000 (12:51 -0500)
committerSage Weil <sage@redhat.com>
Thu, 20 Sep 2018 13:35:15 +0000 (08:35 -0500)
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 <sage@redhat.com>
src/osd/PG.cc

index 046ba1e9366ec1905c5bbcdb14279486bf81c48c..8cf9f6c8e98d6e0af52127e0bc00ab01c5d9bb84 100644 (file)
@@ -2750,13 +2750,23 @@ void PG::merge_from(map<spg_t,PGRef>& 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;
   }