diff options
author | Jack Mulrow <jack.mulrow@mongodb.com> | 2022-06-09 18:22:40 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-06-09 23:05:46 +0000 |
commit | d12805a9e4af786e564ac21add3391aa7aaf8409 (patch) | |
tree | 9b1fb5446336ea8d7df615b99ca189d102fd584f /src/mongo/db/s | |
parent | 0f2eaf1d73a64c31d3cc014205047b8838dcc4c4 (diff) | |
download | mongo-d12805a9e4af786e564ac21add3391aa7aaf8409.tar.gz |
SERVER-66725 SERVER-66659 Incoming retryable txns abort old txns and abort conflicting txns once
(cherry picked from commit bc385b8dcb5b7a550cefaada9d44bc9ded5164de)
Diffstat (limited to 'src/mongo/db/s')
-rw-r--r-- | src/mongo/db/s/resharding/resharding_oplog_session_application_test.cpp | 10 | ||||
-rw-r--r-- | src/mongo/db/s/resharding/resharding_txn_cloner_test.cpp | 20 |
2 files changed, 30 insertions, 0 deletions
diff --git a/src/mongo/db/s/resharding/resharding_oplog_session_application_test.cpp b/src/mongo/db/s/resharding/resharding_oplog_session_application_test.cpp index 9ab8df13170..164970c9305 100644 --- a/src/mongo/db/s/resharding/resharding_oplog_session_application_test.cpp +++ b/src/mongo/db/s/resharding/resharding_oplog_session_application_test.cpp @@ -693,6 +693,16 @@ TEST_F(ReshardingOplogSessionApplicationTest, TxnNumber internalTxnTxnNumber = 1; StmtId stmtId = 2; + // Make two in progress transactions so the one started by resharding must block. + { + auto newClientOwned = getServiceContext()->makeClient("newClient"); + AlternativeClientRegion acr(newClientOwned); + auto newOpCtx = cc().makeOperationContext(); + makeInProgressTxn(newOpCtx.get(), + makeLogicalSessionIdWithTxnNumberAndUUIDForTest(retryableWriteLsid, + retryableWriteTxnNumber), + internalTxnTxnNumber); + } { auto opCtx = makeOperationContext(); makeInProgressTxn(opCtx.get(), internalTxnLsid, internalTxnTxnNumber); diff --git a/src/mongo/db/s/resharding/resharding_txn_cloner_test.cpp b/src/mongo/db/s/resharding/resharding_txn_cloner_test.cpp index 438ee588af7..e4f4f1f2b61 100644 --- a/src/mongo/db/s/resharding/resharding_txn_cloner_test.cpp +++ b/src/mongo/db/s/resharding/resharding_txn_cloner_test.cpp @@ -994,6 +994,16 @@ TEST_F(ReshardingTxnClonerTest, retryableWriteTxnNumber); TxnNumber internalTxnTxnNumber = 1; + // Make two in progress transactions so the one started by resharding must block. + { + auto newClientOwned = getServiceContext()->makeClient("newClient"); + AlternativeClientRegion acr(newClientOwned); + auto newOpCtx = cc().makeOperationContext(); + makeInProgressTxn(newOpCtx.get(), + makeLogicalSessionIdWithTxnNumberAndUUIDForTest(retryableWriteLsid, + retryableWriteTxnNumber), + internalTxnTxnNumber); + } makeInProgressTxn(operationContext(), internalTxnLsid, internalTxnTxnNumber); auto lastOplogTs = getLatestOplogTimestamp(operationContext()); @@ -1086,6 +1096,16 @@ TEST_F(ReshardingTxnClonerTest, CancelableWhileWaitingOnInProgressInternalTxnFor retryableWriteTxnNumber); TxnNumber internalTxnTxnNumber = 1; + // Make two in progress transactions so the one started by resharding must block. + { + auto newClientOwned = getServiceContext()->makeClient("newClient"); + AlternativeClientRegion acr(newClientOwned); + auto newOpCtx = cc().makeOperationContext(); + makeInProgressTxn(newOpCtx.get(), + makeLogicalSessionIdWithTxnNumberAndUUIDForTest(retryableWriteLsid, + retryableWriteTxnNumber), + internalTxnTxnNumber); + } makeInProgressTxn(operationContext(), internalTxnLsid, internalTxnTxnNumber); ON_BLOCK_EXIT([&] { abortTxn(operationContext(), internalTxnLsid, internalTxnTxnNumber); }); |