diff options
author | Judah Schvimer <judah@mongodb.com> | 2018-01-26 17:13:14 -0500 |
---|---|---|
committer | Judah Schvimer <judah@mongodb.com> | 2018-01-29 17:11:10 -0500 |
commit | 334ed9e07f86efbc50061630b85a9e04d7e07d18 (patch) | |
tree | 251445e21119f1523bc88276e7521ef04ad3b1c9 /src/mongo/db/repl/bgsync.cpp | |
parent | cb6ebf5ed1ce470e6d725c7da96d8dc6d72b7449 (diff) | |
download | mongo-334ed9e07f86efbc50061630b85a9e04d7e07d18.tar.gz |
SERVER-32196 choose which rollback algorithm to use with supportsRecoverToStableTimestamp
Diffstat (limited to 'src/mongo/db/repl/bgsync.cpp')
-rw-r--r-- | src/mongo/db/repl/bgsync.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/mongo/db/repl/bgsync.cpp b/src/mongo/db/repl/bgsync.cpp index 22b4788808d..2585c46582d 100644 --- a/src/mongo/db/repl/bgsync.cpp +++ b/src/mongo/db/repl/bgsync.cpp @@ -645,8 +645,14 @@ void BackgroundSync::_runRollback(OperationContext* opCtx, return connection->get(); }; - log() << "Rollback using the 'rollbackViaRefetch' method."; - _fallBackOnRollbackViaRefetch(opCtx, source, requiredRBID, &localOplog, getConnection); + auto storageEngine = opCtx->getServiceContext()->getGlobalStorageEngine(); + if (storageEngine->supportsRecoverToStableTimestamp()) { + _runRollbackViaRecoverToCheckpoint( + opCtx, source, &localOplog, storageInterface, getConnection); + } else { + log() << "Rollback using the 'rollbackViaRefetch' method."; + _fallBackOnRollbackViaRefetch(opCtx, source, requiredRBID, &localOplog, getConnection); + } // Reset the producer to clear the sync source and the last optime fetched. stop(true); @@ -669,8 +675,6 @@ void BackgroundSync::_runRollbackViaRecoverToCheckpoint( } } - fassertFailedNoTrace(40651); - _rollback = stdx::make_unique<RollbackImpl>( localOplog, &remoteOplog, storageInterface, _replicationProcess, _replCoord); @@ -678,8 +682,11 @@ void BackgroundSync::_runRollbackViaRecoverToCheckpoint( auto status = _rollback->runRollback(opCtx); if (status.isOK()) { log() << "Rollback successful."; + } else if (status == ErrorCodes::UnrecoverableRollbackError) { + severe() << "Rollback failed with unrecoverable error: " << status; + fassertFailedWithStatusNoTrace(50666, status); } else { - warning() << "Rollback failed with error: " << status; + warning() << "Rollback failed with retryable error: " << status; } } |