diff options
author | Cheahuychou Mao <mao.cheahuychou@gmail.com> | 2021-10-20 15:00:08 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-10-20 15:27:36 +0000 |
commit | 8422d2de828acf86ffa102b19e75a7552d06d440 (patch) | |
tree | 53605ed78d1829e8da9e925bf9890d855562674c | |
parent | 5d54422313209ae5dc5be5de65450cce58a0ff00 (diff) | |
download | mongo-8422d2de828acf86ffa102b19e75a7552d06d440.tar.gz |
SERVER-60815 Fix race between two TransactionCoordinators can race in TransactionCoordinatorServiceTestr5.2.0-alpha
-rw-r--r-- | src/mongo/db/s/transaction_coordinator_service_test.cpp | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/src/mongo/db/s/transaction_coordinator_service_test.cpp b/src/mongo/db/s/transaction_coordinator_service_test.cpp index eb750325ca7..c99cc39ec25 100644 --- a/src/mongo/db/s/transaction_coordinator_service_test.cpp +++ b/src/mongo/db/s/transaction_coordinator_service_test.cpp @@ -454,10 +454,9 @@ TEST_F(TransactionCoordinatorServiceTest, operationContext(), _lsid, _txnNumberAndRetryCounter, kCommitDeadline); // Progress the transaction up until the point where one participant voted to abort and the - // coordinator has sent abort and is waiting for abort acks. + // coordinator has sent abort and is waiting for an abort ack. auto oldTxnCommitDecisionFuture = *coordinatorService->coordinateCommit( - operationContext(), _lsid, _txnNumberAndRetryCounter, kTwoShardIdSet); - assertPrepareSentAndRespondWithSuccess(); + operationContext(), _lsid, _txnNumberAndRetryCounter, kOneShardIdSet); assertPrepareSentAndRespondWithNoSuchTransaction(); // Create a coordinator with a higher transaction retry counter. @@ -467,18 +466,14 @@ TEST_F(TransactionCoordinatorServiceTest, coordinatorService->createCoordinator( operationContext(), _lsid, newTxnNumberAndRetryCounter, kCommitDeadline); - auto newTxnCommitDecisionFuture = *coordinatorService->coordinateCommit( - operationContext(), _lsid, newTxnNumberAndRetryCounter, kTwoShardIdSet); - - // Finish aborting the original commit by sending it abort acks from both participants. - assertAbortSentAndRespondWithSuccess(); + // Finish aborting the original commit by sending an abort ack. assertAbortSentAndRespondWithSuccess(); - // Simulate all participants acking prepare/voting to commit. - assertPrepareSentAndRespondWithSuccess(); - assertPrepareSentAndRespondWithSuccess(); + auto newTxnCommitDecisionFuture = *coordinatorService->coordinateCommit( + operationContext(), _lsid, newTxnNumberAndRetryCounter, kOneShardIdSet); - assertCommitSentAndRespondWithSuccess(); + // Simulate acking prepare/voting to commit. + assertPrepareSentAndRespondWithSuccess(); assertCommitSentAndRespondWithSuccess(); ASSERT_THROWS_CODE( |