diff options
author | clang-format-7.0.1 <adam.martin@10gen.com> | 2019-07-26 18:20:35 -0400 |
---|---|---|
committer | ADAM David Alan Martin <adam.martin@10gen.com> | 2019-07-27 11:02:23 -0400 |
commit | 134a4083953270e8a11430395357fb70a29047ad (patch) | |
tree | dd428e1230e31d92b20b393dfdc17ffe7fa79cb6 /jstests/replsets/commit_transaction_recovery.js | |
parent | 1e46b5049003f427047e723ea5fab15b5a9253ca (diff) | |
download | mongo-134a4083953270e8a11430395357fb70a29047ad.tar.gz |
SERVER-41772 Apply clang-format 7.0.1 to the codebase
Diffstat (limited to 'jstests/replsets/commit_transaction_recovery.js')
-rw-r--r-- | jstests/replsets/commit_transaction_recovery.js | 90 |
1 files changed, 45 insertions, 45 deletions
diff --git a/jstests/replsets/commit_transaction_recovery.js b/jstests/replsets/commit_transaction_recovery.js index a1a12e8c183..cdd2c49a830 100644 --- a/jstests/replsets/commit_transaction_recovery.js +++ b/jstests/replsets/commit_transaction_recovery.js @@ -7,64 +7,64 @@ */ (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(); - let primary = replTest.getPrimary(); +let primary = replTest.getPrimary(); - const dbName = "test"; - const collName = "commit_transaction_recovery"; - let testDB = primary.getDB(dbName); - const testColl = testDB.getCollection(collName); +const dbName = "test"; +const collName = "commit_transaction_recovery"; +let testDB = primary.getDB(dbName); +const testColl = testDB.getCollection(collName); - testDB.runCommand({drop: collName}); - assert.commandWorked(testDB.runCommand({create: collName})); +testDB.runCommand({drop: collName}); +assert.commandWorked(testDB.runCommand({create: collName})); - let session = primary.startSession({causalConsistency: false}); - let sessionDB = session.getDatabase(dbName); - const sessionColl = sessionDB.getCollection(collName); +let session = primary.startSession({causalConsistency: false}); +let sessionDB = session.getDatabase(dbName); +const sessionColl = sessionDB.getCollection(collName); - session.startTransaction(); - assert.commandWorked(sessionColl.insert({_id: 1})); - let prepareTimestamp = PrepareHelpers.prepareTransaction(session); +session.startTransaction(); +assert.commandWorked(sessionColl.insert({_id: 1})); +let prepareTimestamp = PrepareHelpers.prepareTransaction(session); - jsTestLog("Disable snapshotting on all nodes"); - // Disable snapshotting so that future operations do not enter the majority snapshot. - assert.commandWorked( - primary.adminCommand({configureFailPoint: "disableSnapshotting", mode: "alwaysOn"})); +jsTestLog("Disable snapshotting on all nodes"); +// Disable snapshotting so that future operations do not enter the majority snapshot. +assert.commandWorked( + primary.adminCommand({configureFailPoint: "disableSnapshotting", mode: "alwaysOn"})); - jsTestLog("Committing the transaction"); - // Since the commitTimestamp is after the last snapshot, this oplog entry will be replayed - // during replication recovery during restart. - assert.commandWorked(PrepareHelpers.commitTransaction(session, prepareTimestamp)); +jsTestLog("Committing the transaction"); +// Since the commitTimestamp is after the last snapshot, this oplog entry will be replayed +// during replication recovery during restart. +assert.commandWorked(PrepareHelpers.commitTransaction(session, prepareTimestamp)); - jsTestLog("Restarting node"); +jsTestLog("Restarting node"); - // Perform a clean shutdown and restart. Note that the 'disableSnapshotting' failpoint will be - // unset on the node following the restart. - replTest.restart(primary); +// Perform a clean shutdown and restart. Note that the 'disableSnapshotting' failpoint will be +// unset on the node following the restart. +replTest.restart(primary); - jsTestLog("Node was restarted"); +jsTestLog("Node was restarted"); - primary = replTest.getPrimary(); - testDB = primary.getDB(dbName); - session = primary.startSession({causalConsistency: false}); - sessionDB = session.getDatabase(dbName); - session.startTransaction(); +primary = replTest.getPrimary(); +testDB = primary.getDB(dbName); +session = primary.startSession({causalConsistency: false}); +sessionDB = session.getDatabase(dbName); +session.startTransaction(); - // Make sure that we can read the document from the transaction after recovery. - assert.eq(testDB[collName].findOne({_id: 1}), {_id: 1}); +// Make sure that we can read the document from the transaction after recovery. +assert.eq(testDB[collName].findOne({_id: 1}), {_id: 1}); - // Make sure that another write on the same document from the transaction has no write conflict. - // Also, make sure that we can run another transaction after recovery without any problems. - assert.commandWorked(sessionDB[collName].update({_id: 1}, {_id: 1, a: 1})); - prepareTimestamp = PrepareHelpers.prepareTransaction(session); - assert.commandWorked(PrepareHelpers.commitTransaction(session, prepareTimestamp)); - assert.eq(testDB[collName].findOne({_id: 1}), {_id: 1, a: 1}); +// Make sure that another write on the same document from the transaction has no write conflict. +// Also, make sure that we can run another transaction after recovery without any problems. +assert.commandWorked(sessionDB[collName].update({_id: 1}, {_id: 1, a: 1})); +prepareTimestamp = PrepareHelpers.prepareTransaction(session); +assert.commandWorked(PrepareHelpers.commitTransaction(session, prepareTimestamp)); +assert.eq(testDB[collName].findOne({_id: 1}), {_id: 1, a: 1}); - replTest.stopSet(); +replTest.stopSet(); }()); |