]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/PG: align past_intervals and last_epoch_clean for fabricated merge target
authorSage Weil <sage@redhat.com>
Tue, 19 Feb 2019 15:31:50 +0000 (09:31 -0600)
committerSage Weil <sage@redhat.com>
Tue, 19 Feb 2019 15:34:31 +0000 (09:34 -0600)
Fix fix from b79442efce479fde7f8bda8fdadf86e91003a327.  We need to
use last_epoch_clean *after* we set it when comparing it to the
past_intervals.

Fixes: http://tracker.ceph.com/issues/37511
Fixes: http://tracker.ceph.com/issues/24866
Signed-off-by: Sage Weil <sage@redhat.com>
src/osd/PG.cc

index 846790040e0a323255717fd0dc072d4f2cdb884d..b2e1b89dec5f5c4bec8f533aa84d1a5284f067e0 100644 (file)
@@ -2779,17 +2779,6 @@ void PG::merge_from(map<spg_t,PGRef>& sources, RecoveryCtx *rctx,
     // remapped in concert with each other...
     info.history = sources.begin()->second->info.history;
 
-    // if the past_intervals start is later than last_epoch_clean, it implies
-    // the source repeered again but the target didn't.  avoid the discrepancy
-    // but adjusting the interval start backwards to match.
-    auto pib = past_intervals.get_bounds();
-    if (info.history.last_epoch_clean < pib.first) {
-      dout(10) << __func__ << " last_epoch_clean "
-              << info.history.last_epoch_clean << " < past_interval start "
-              << pib.first << ", adjusting start backwards" << dendl;
-      past_intervals.adjust_start_backwards(info.history.last_epoch_clean);
-    }
-
     // 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.
@@ -2805,6 +2794,20 @@ void PG::merge_from(map<spg_t,PGRef>& sources, RecoveryCtx *rctx,
             << " from pool last_dec_*, source pg history was "
             << sources.begin()->second->info.history
             << dendl;
+
+    // if the past_intervals start is later than last_epoch_clean, it
+    // implies the source repeered again but the target didn't, or
+    // that the source became clean in a later epoch than the target.
+    // avoid the discrepancy but adjusting the interval start
+    // backwards to match so that check_past_interval_bounds() will
+    // not complain.
+    auto pib = past_intervals.get_bounds();
+    if (info.history.last_epoch_clean < pib.first) {
+      dout(10) << __func__ << " last_epoch_clean "
+              << info.history.last_epoch_clean << " < past_interval start "
+              << pib.first << ", adjusting start backwards" << dendl;
+      past_intervals.adjust_start_backwards(info.history.last_epoch_clean);
+    }
   }
 
   dirty_info = true;