[SERVER-80328] Fix race condition in cancel_coordinate_txn_commit_with_tickets_exhausted.js Created: 23/Aug/23  Updated: 29/Oct/23  Resolved: 24/Aug/23

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 7.1.0-rc0

Type: Improvement Priority: Major - P3
Reporter: Ivan Fefer Assignee: Ivan Fefer
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Backwards Compatibility: Fully Compatible
Sprint: QE 2023-09-04
Participants:
Linked BF Score: 30

 Description   

Test cancel_coordinate_txn_commit_with_tickets_exhausted.js checks that transaction coordinator will correctly timeout and abort transaction even if all write tickets from WiredTiger are exhausted.

It uses hangWithLockDuringBatchRemove to create threads that exhaust write tickets and transaction coordinator server status to determine when transaction is past certain point: https://github.com/mongodb/mongo/blob/a4f458fe4d7a44eba056f5c150753e73067c8e4d/jstests/sharding/cancel_coordinate_txn_commit_with_tickets_exhausted.js#L135

After the transaction is past kWaitingForVotes, it disabled the fail points.

It used to work, because we used to do everything inside transaction coordinator synchronously, but as a side effect of SERVER-79091 we know delete coordinator doc asynchronously and the test run one transaction before starting the test to initialize transaction_coordinator system: 

https://github.com/mongodb/mongo/blob/a4f458fe4d7a44eba056f5c150753e73067c8e4d/jstests/sharding/cancel_coordinate_txn_commit_with_tickets_exhausted.js#L86

In rare cases it is possible that the check (line 135) that supposed to check our main transaction (line 99) will be satisfied by prior transaction (line 86) and fail point will disabled before we are able to satisfy check on line 106



 Comments   
Comment by Githook User [ 24/Aug/23 ]

Author:

{'name': 'Ivan Fefer', 'email': 'ivan.fefer@mongodb.com', 'username': 'Fefer-Ivan'}

Message: SERVER-80328 Fix race condition in cancel_coordinate_txn_commit_with_tickets_exhausted.js
Branch: master
https://github.com/mongodb/mongo/commit/c0c78d35b945397d6fdc789d291fccf83cba08a4

Generated at Thu Feb 08 06:43:15 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.