[SERVER-51673] Fix test case in transaction_coordinator_test to shut down AsyncWorkScheduler before attempting to persist decision Created: 15/Oct/20  Updated: 29/Oct/23  Resolved: 16/Oct/20

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: None
Fix Version/s: 4.9.0, 4.4.2

Type: Task Priority: Major - P3
Reporter: Max Hirschhorn Assignee: Max Hirschhorn
Resolution: Fixed Votes: 0
Labels: sharding-wfbf-day
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Depends
Related
is related to SERVER-41189 Make transaction coordinator retry pe... Closed
Backwards Compatibility: Fully Compatible
Backport Requested:
v4.4
Sprint: Sharding 2020-10-19
Participants:
Linked BF Score: 0

 Description   

The PersistCommitDecisionWhenNoDocumentForTransactionExistsCanBeInterruptedAndReturnsError test case fails due to decision being persistent before txn::AsyncWorkScheduler is shut down.

diff --git a/src/mongo/db/s/transaction_coordinator_test.cpp b/src/mongo/db/s/transaction_coordinator_test.cpp
index e7426e97de..d962ffb622 100644
--- a/src/mongo/db/s/transaction_coordinator_test.cpp
+++ b/src/mongo/db/s/transaction_coordinator_test.cpp
@@ -724,6 +724,7 @@ TEST_F(TransactionCoordinatorDriverPersistenceTest,
             decision.setCommitTimestamp(_commitTimestamp);
             return decision;
         }());
+    sleepmillis(500);
     _aws->shutdown({ErrorCodes::TransactionCoordinatorSteppingDown, "Shutdown for test"});
 
     ASSERT_THROWS_CODE(

{"t":{"$date":"2020-10-15T19:28:25.165Z"},"s":"I",  "c":"TEST",     "id":4680100, "ctx":"main","msg":"FAIL","attr":{"test":"PersistCommitDecisionWhenNoDocumentForTransactionExistsCanBeInterruptedAndReturnsError","type":"TestAssertionFailureException","error":"Expected expression future.get() to throw AssertionException but it threw nothing. @src/mongo/db/s/transaction_coordinator_test.cpp:731"



 Comments   
Comment by Githook User [ 16/Oct/20 ]

Author:

{'name': 'Max Hirschhorn', 'email': 'max.hirschhorn@mongodb.com', 'username': 'visemet'}

Message: SERVER-51673 Fix test to shut down txn::AWS before persisting decision.

It is otherwise possible for the decision to be persisted rather than
getting interrupted by the txn::AsyncWorkScheduler being shut down.

(cherry picked from commit b2c7ec198b99851763370bd42980a5092b49b5bd)
Branch: v4.4
https://github.com/mongodb/mongo/commit/0b892bcaf981f978ade10cc0d64adeff9e23a436

Comment by Githook User [ 16/Oct/20 ]

Author:

{'name': 'Max Hirschhorn', 'email': 'max.hirschhorn@mongodb.com', 'username': 'visemet'}

Message: SERVER-51673 Fix test to shut down txn::AWS before persisting decision.

It is otherwise possible for the decision to be persisted rather than
getting interrupted by the txn::AsyncWorkScheduler being shut down.
Branch: master
https://github.com/mongodb/mongo/commit/b2c7ec198b99851763370bd42980a5092b49b5bd

Generated at Thu Feb 08 05:26:07 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.