summaryrefslogtreecommitdiff
path: root/src/mongo/db/s
diff options
context:
space:
mode:
authorJack Mulrow <jack.mulrow@mongodb.com>2022-06-09 18:22:40 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-06-09 23:05:46 +0000
commitd12805a9e4af786e564ac21add3391aa7aaf8409 (patch)
tree9b1fb5446336ea8d7df615b99ca189d102fd584f /src/mongo/db/s
parent0f2eaf1d73a64c31d3cc014205047b8838dcc4c4 (diff)
downloadmongo-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.cpp10
-rw-r--r--src/mongo/db/s/resharding/resharding_txn_cloner_test.cpp20
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); });