summaryrefslogtreecommitdiff
path: root/src/mongo/db/repl/rollback_impl.h
diff options
context:
space:
mode:
authorWilliam Schultz <william.schultz@mongodb.com>2018-01-25 16:37:30 -0500
committerWilliam Schultz <william.schultz@mongodb.com>2018-01-25 16:42:22 -0500
commit18eb990734653fc80f7d8c2916033e61ea7320e5 (patch)
treee039c837bb4aa0d2f17d0d6eccd5acc9010bb789 /src/mongo/db/repl/rollback_impl.h
parentb3e32fea3fb27391fce4b170b4dcec1f25b780e4 (diff)
downloadmongo-18eb990734653fc80f7d8c2916033e61ea7320e5.tar.gz
SERVER-30818 Wait for all background index builds to complete before starting rollback to checkpoint
Diffstat (limited to 'src/mongo/db/repl/rollback_impl.h')
-rw-r--r--src/mongo/db/repl/rollback_impl.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/mongo/db/repl/rollback_impl.h b/src/mongo/db/repl/rollback_impl.h
index b8a6b5b04cf..c88899e70b0 100644
--- a/src/mongo/db/repl/rollback_impl.h
+++ b/src/mongo/db/repl/rollback_impl.h
@@ -100,6 +100,11 @@ public:
virtual void onTransitionToRollback() noexcept {}
/**
+ * Function called after all background index builds have completed.
+ */
+ virtual void onBgIndexesComplete() noexcept {}
+
+ /**
* Function called after we find the common point.
*/
virtual void onCommonPointFound(Timestamp commonPoint) noexcept {}
@@ -169,6 +174,16 @@ private:
Status _transitionToRollback(OperationContext* opCtx);
/**
+ * Waits for any in-progress background index builds to complete. We do this before beginning
+ * the rollback process to prevent any issues surrounding index builds pausing/resuming around a
+ * call to 'recoverToStableTimestamp'. It's not clear that an index build, resumed in this way,
+ * that continues until completion, would be consistent with the collection data. Waiting for
+ * all background index builds to complete is a conservative approach, to avoid any of these
+ * potential issues.
+ */
+ Status _awaitBgIndexCompletion(OperationContext* opCtx);
+
+ /**
* Recovers to the stable timestamp while holding the global exclusive lock.
*/
Status _recoverToStableTimestamp(OperationContext* opCtx);