summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Hirschhorn <max.hirschhorn@mongodb.com>2022-03-28 22:08:31 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-03-28 22:53:55 +0000
commit5448856fd7cf65bd7d480f2028f04aa2e568ee75 (patch)
treee388d0f3484118a4978b4fd8c7b0f2bfb535ff07
parentbe17903744497b4c6224b1db4ddfb60386535ad8 (diff)
downloadmongo-5448856fd7cf65bd7d480f2028f04aa2e568ee75.tar.gz
SERVER-64903 Wait for ShardServerCatalogCacheLoader deletes in test.
The cancel_coordinate_txn_commit_with_tickets_exhausted.js test expects the removeOperations threads to be the ones blocked on the hangWithLockDuringBatchRemove failpoint and holding all available WiredTiger write tickets. (cherry picked from commit 59f2fcc33536dc6346e68d12cc0b9c8ef1b0b20c)
-rw-r--r--jstests/sharding/cancel_coordinate_txn_commit_with_tickets_exhausted.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/jstests/sharding/cancel_coordinate_txn_commit_with_tickets_exhausted.js b/jstests/sharding/cancel_coordinate_txn_commit_with_tickets_exhausted.js
index ee7221e80d5..b4e31fd08a2 100644
--- a/jstests/sharding/cancel_coordinate_txn_commit_with_tickets_exhausted.js
+++ b/jstests/sharding/cancel_coordinate_txn_commit_with_tickets_exhausted.js
@@ -52,6 +52,14 @@ CreateShardedCollectionUtil.shardCollectionWithChunks(sourceCollection, {key: 1}
{min: {key: 0}, max: {key: MaxKey}, shard: st.shard1.shardName},
]);
+// The ShardServerCatalogCacheLoader thread may perform deletes in the background on the
+// config.cache.chunks.test.mycoll collection. Its deletes are also eligible to be blocked by the
+// hangWithLockDuringBatchRemove failpoint and will prevent a removeOperation thread from acquiring
+// a WiredTiger write ticket. We wait for it to finish any delete operations by explicitly running
+// the _flushRoutingTableCacheUpdates command.
+assert.commandWorked(
+ txnCoordinator.adminCommand({_flushRoutingTableCacheUpdates: sourceCollection.getFullName()}));
+
const removeOperationThreads = Array.from({length: kNumWriteTickets}).map(() => {
return new Thread(function removeOperation(host, dbName, collName, insertLatch) {
const conn = new Mongo(host);