diff options
Diffstat (limited to 'jstests/replsets/shutdown_with_prepared_transaction.js')
-rw-r--r-- | jstests/replsets/shutdown_with_prepared_transaction.js | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/jstests/replsets/shutdown_with_prepared_transaction.js b/jstests/replsets/shutdown_with_prepared_transaction.js index f8844b21074..d241df1a68b 100644 --- a/jstests/replsets/shutdown_with_prepared_transaction.js +++ b/jstests/replsets/shutdown_with_prepared_transaction.js @@ -4,35 +4,35 @@ * @tags: [uses_transactions, uses_prepare_transaction] */ (function() { - "use strict"; - load("jstests/core/txns/libs/prepare_helpers.js"); +"use strict"; +load("jstests/core/txns/libs/prepare_helpers.js"); - const replTest = new ReplSetTest({nodes: 1}); - replTest.startSet(); - replTest.initiate(); +const replTest = new ReplSetTest({nodes: 1}); +replTest.startSet(); +replTest.initiate(); - const conn = replTest.getPrimary(); +const conn = replTest.getPrimary(); - const dbName = "test"; - const collName = "shutdown_with_prepared_txn"; - const testDB = conn.getDB(dbName); - const testColl = testDB.getCollection(collName); +const dbName = "test"; +const collName = "shutdown_with_prepared_txn"; +const testDB = conn.getDB(dbName); +const testColl = testDB.getCollection(collName); - assert.commandWorked(testDB.runCommand({create: collName, writeConcern: {w: "majority"}})); +assert.commandWorked(testDB.runCommand({create: collName, writeConcern: {w: "majority"}})); - const session = conn.startSession({causalConsistency: false}); - const sessionDB = session.getDatabase(dbName); - const sessionColl = sessionDB.getCollection(collName); +const session = conn.startSession({causalConsistency: false}); +const sessionDB = session.getDatabase(dbName); +const sessionColl = sessionDB.getCollection(collName); - jsTestLog("Starting a simple transaction and putting it into prepare"); +jsTestLog("Starting a simple transaction and putting it into prepare"); - session.startTransaction(); - assert.commandWorked(sessionColl.insert({_id: 1})); +session.startTransaction(); +assert.commandWorked(sessionColl.insert({_id: 1})); - PrepareHelpers.prepareTransaction(session); +PrepareHelpers.prepareTransaction(session); - jsTestLog("Shutting down the set with the transaction still in prepare state"); - // Skip validation during ReplSetTest cleanup since validate() will block behind the prepared - // transaction's locks when trying to take a collection X lock. - replTest.stopSet(null /*signal*/, false /*forRestart*/, {skipValidation: true}); +jsTestLog("Shutting down the set with the transaction still in prepare state"); +// Skip validation during ReplSetTest cleanup since validate() will block behind the prepared +// transaction's locks when trying to take a collection X lock. +replTest.stopSet(null /*signal*/, false /*forRestart*/, {skipValidation: true}); }()); |