diff options
Diffstat (limited to 'jstests/replsets/rollback_files_no_prepare_conflict.js')
-rw-r--r-- | jstests/replsets/rollback_files_no_prepare_conflict.js | 64 |
1 files changed, 32 insertions, 32 deletions
diff --git a/jstests/replsets/rollback_files_no_prepare_conflict.js b/jstests/replsets/rollback_files_no_prepare_conflict.js index 1eb1e7a3a4c..40cc954b068 100644 --- a/jstests/replsets/rollback_files_no_prepare_conflict.js +++ b/jstests/replsets/rollback_files_no_prepare_conflict.js @@ -8,49 +8,49 @@ * @tags: [uses_transactions, uses_prepare_transaction] */ (function() { - "use strict"; - load("jstests/core/txns/libs/prepare_helpers.js"); - load("jstests/replsets/libs/rollback_test.js"); +"use strict"; +load("jstests/core/txns/libs/prepare_helpers.js"); +load("jstests/replsets/libs/rollback_test.js"); - const name = "rollback_files_no_prepare_conflicts"; - const dbName = "test"; - const collName = name; +const name = "rollback_files_no_prepare_conflicts"; +const dbName = "test"; +const collName = name; - const rollbackTest = new RollbackTest(name); +const rollbackTest = new RollbackTest(name); - let primary = rollbackTest.getPrimary(); - let testDB = primary.getDB(dbName); - let testColl = testDB.getCollection(collName); +let primary = rollbackTest.getPrimary(); +let testDB = primary.getDB(dbName); +let testColl = testDB.getCollection(collName); - jsTestLog("Issue an insert that will be common to both nodes."); - assert.commandWorked(testColl.insert({_id: 42, a: "one"})); +jsTestLog("Issue an insert that will be common to both nodes."); +assert.commandWorked(testColl.insert({_id: 42, a: "one"})); - rollbackTest.transitionToRollbackOperations(); +rollbackTest.transitionToRollbackOperations(); - const session = primary.startSession(); - const sessionDB = session.getDatabase(dbName); - const sessionColl = sessionDB.getCollection(collName); +const session = primary.startSession(); +const sessionDB = session.getDatabase(dbName); +const sessionColl = sessionDB.getCollection(collName); - jsTestLog("Make an update to that document outside of a transaction on the rollback node."); - assert.commandWorked(testColl.update({_id: 42, a: "one"}, {_id: 42, a: "two"})); +jsTestLog("Make an update to that document outside of a transaction on the rollback node."); +assert.commandWorked(testColl.update({_id: 42, a: "one"}, {_id: 42, a: "two"})); - session.startTransaction(); +session.startTransaction(); - jsTestLog("Update the same document on the same node, this time as part of a transaction."); - assert.commandWorked(sessionColl.update({_id: 42, a: "two"}, {_id: 42, a: "three"})); +jsTestLog("Update the same document on the same node, this time as part of a transaction."); +assert.commandWorked(sessionColl.update({_id: 42, a: "two"}, {_id: 42, a: "three"})); - jsTestLog("Prepare the transaction on the rollback node."); - PrepareHelpers.prepareTransaction(session, {w: 1}); +jsTestLog("Prepare the transaction on the rollback node."); +PrepareHelpers.prepareTransaction(session, {w: 1}); - rollbackTest.transitionToSyncSourceOperationsBeforeRollback(); - rollbackTest.transitionToSyncSourceOperationsDuringRollback(); - rollbackTest.transitionToSteadyStateOperations(); +rollbackTest.transitionToSyncSourceOperationsBeforeRollback(); +rollbackTest.transitionToSyncSourceOperationsDuringRollback(); +rollbackTest.transitionToSteadyStateOperations(); - jsTestLog("Verify that the document is in the same state as it was at the common point."); - primary = rollbackTest.getPrimary(); - testDB = primary.getDB(dbName); - testColl = testDB.getCollection(collName); - assert.docEq(testColl.findOne({_id: 42}), {_id: 42, a: "one"}); +jsTestLog("Verify that the document is in the same state as it was at the common point."); +primary = rollbackTest.getPrimary(); +testDB = primary.getDB(dbName); +testColl = testDB.getCollection(collName); +assert.docEq(testColl.findOne({_id: 42}), {_id: 42, a: "one"}); - rollbackTest.stop(); +rollbackTest.stop(); })(); |