summaryrefslogtreecommitdiff
path: root/src/mongo/db/write_concern.cpp
diff options
context:
space:
mode:
authorGregory Wlodarek <gregory.wlodarek@mongodb.com>2022-03-21 12:59:43 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-03-21 14:11:24 +0000
commit0f5f68c816ffae7950eeb7ca8c176a3f755d889b (patch)
treeeab82f8ffdf5634c6b7c4fbfd62e26fa980830bf /src/mongo/db/write_concern.cpp
parentb7cf8ee825a5e4e5e511a591172fcfbeada42b78 (diff)
downloadmongo-0f5f68c816ffae7950eeb7ca8c176a3f755d889b.tar.gz
SERVER-63989 Release the snapshot before pausing in the hangBeforeWaitingForWriteConcern fail point
Diffstat (limited to 'src/mongo/db/write_concern.cpp')
-rw-r--r--src/mongo/db/write_concern.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/mongo/db/write_concern.cpp b/src/mongo/db/write_concern.cpp
index 91a8cddac86..94d5350dfc1 100644
--- a/src/mongo/db/write_concern.cpp
+++ b/src/mongo/db/write_concern.cpp
@@ -275,8 +275,15 @@ Status waitForWriteConcern(OperationContext* opCtx,
auto* const storageEngine = opCtx->getServiceContext()->getStorageEngine();
auto const replCoord = repl::ReplicationCoordinator::get(opCtx);
- if (!opCtx->getClient()->isInDirectClient()) {
+ if (MONGO_unlikely(hangBeforeWaitingForWriteConcern.shouldFail()) &&
+ !opCtx->getClient()->isInDirectClient()) {
// Respecting this failpoint for internal clients prevents stepup from working properly.
+ // This fail point pauses with an open snapshot on the oplog. Some tests pause on this fail
+ // point prior to running replication rollback. This prevents the operation from being
+ // killed and the snapshot being released. Hence, we release the snapshot here.
+ auto recoveryUnit = opCtx->releaseAndReplaceRecoveryUnit();
+ recoveryUnit.reset();
+
hangBeforeWaitingForWriteConcern.pauseWhileSet();
}