diff options
author | Louis Williams <louis.williams@mongodb.com> | 2019-12-16 18:49:39 +0000 |
---|---|---|
committer | evergreen <evergreen@mongodb.com> | 2019-12-16 18:49:39 +0000 |
commit | 59152df7655101ee551d6432727170b42fcd136f (patch) | |
tree | 0036dd72644c697f4a1e265f1eee948b9cfaa913 /src/mongo/db/repl/bgsync.cpp | |
parent | 4cba7e97d3561efe26a7145c03bb91648343f396 (diff) | |
download | mongo-59152df7655101ee551d6432727170b42fcd136f.tar.gz |
SERVER-39452 Support rollback via refetch for two-phase index builds
Diffstat (limited to 'src/mongo/db/repl/bgsync.cpp')
-rw-r--r-- | src/mongo/db/repl/bgsync.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/mongo/db/repl/bgsync.cpp b/src/mongo/db/repl/bgsync.cpp index 508eb889495..e08f286b5be 100644 --- a/src/mongo/db/repl/bgsync.cpp +++ b/src/mongo/db/repl/bgsync.cpp @@ -645,7 +645,7 @@ void BackgroundSync::_runRollback(OperationContext* opCtx, // are visible before potentially truncating the oplog. storageInterface->waitForAllEarlierOplogWritesToBeVisible(opCtx); - IndexBuildsCoordinator::get(opCtx)->onRollback(opCtx); + auto abortedIndexBuilds = IndexBuildsCoordinator::get(opCtx)->onRollback(opCtx); auto storageEngine = opCtx->getServiceContext()->getStorageEngine(); if (!forceRollbackViaRefetch.load() && storageEngine->supportsRecoverToStableTimestamp()) { @@ -654,7 +654,8 @@ void BackgroundSync::_runRollback(OperationContext* opCtx, opCtx, source, &localOplog, storageInterface, getConnection); } else { log() << "Rollback using the 'rollbackViaRefetch' method."; - _fallBackOnRollbackViaRefetch(opCtx, source, requiredRBID, &localOplog, getConnection); + _fallBackOnRollbackViaRefetch( + opCtx, source, abortedIndexBuilds, requiredRBID, &localOplog, getConnection); } // Reset the producer to clear the sync source and the last optime fetched. @@ -699,6 +700,7 @@ void BackgroundSync::_runRollbackViaRecoverToCheckpoint( void BackgroundSync::_fallBackOnRollbackViaRefetch( OperationContext* opCtx, const HostAndPort& source, + const IndexBuilds& abortedIndexBuilds, int requiredRBID, OplogInterface* localOplog, OplogInterfaceRemote::GetConnectionFn getConnection) { @@ -708,7 +710,13 @@ void BackgroundSync::_fallBackOnRollbackViaRefetch( NamespaceString::kRsOplogNamespace.ns(), rollbackRemoteOplogQueryBatchSize.load()); - rollback(opCtx, *localOplog, rollbackSource, requiredRBID, _replCoord, _replicationProcess); + rollback(opCtx, + *localOplog, + rollbackSource, + abortedIndexBuilds, + requiredRBID, + _replCoord, + _replicationProcess); } HostAndPort BackgroundSync::getSyncTarget() const { |