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/initial_sync_reset_oldest_timestamp_after_failed_attempt.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/initial_sync_reset_oldest_timestamp_after_failed_attempt.js')
-rw-r--r-- | jstests/replsets/initial_sync_reset_oldest_timestamp_after_failed_attempt.js | 134 |
1 files changed, 67 insertions, 67 deletions
diff --git a/jstests/replsets/initial_sync_reset_oldest_timestamp_after_failed_attempt.js b/jstests/replsets/initial_sync_reset_oldest_timestamp_after_failed_attempt.js index d589c6320bc..0ec56197438 100644 --- a/jstests/replsets/initial_sync_reset_oldest_timestamp_after_failed_attempt.js +++ b/jstests/replsets/initial_sync_reset_oldest_timestamp_after_failed_attempt.js @@ -7,94 +7,94 @@ */ (function() { - "use strict"; +"use strict"; - load("jstests/libs/check_log.js"); - load("jstests/core/txns/libs/prepare_helpers.js"); +load("jstests/libs/check_log.js"); +load("jstests/core/txns/libs/prepare_helpers.js"); - // Set the number of initial sync attempts to 2 so that the test fails on unplanned failures. - const replTest = - new ReplSetTest({nodes: 2, nodeOptions: {setParameter: "numInitialSyncAttempts=2"}}); - replTest.startSet(); +// Set the number of initial sync attempts to 2 so that the test fails on unplanned failures. +const replTest = + new ReplSetTest({nodes: 2, nodeOptions: {setParameter: "numInitialSyncAttempts=2"}}); +replTest.startSet(); - // Increase the election timeout to 24 hours so that we do not accidentally trigger an election - // while the secondary is restarting. - replTest.initiateWithHighElectionTimeout(); +// Increase the election timeout to 24 hours so that we do not accidentally trigger an election +// while the secondary is restarting. +replTest.initiateWithHighElectionTimeout(); - const primary = replTest.getPrimary(); - let secondary = replTest.getSecondary(); +const primary = replTest.getPrimary(); +let secondary = replTest.getSecondary(); - const dbName = "test"; - const collName = "initial_sync_reset_oldest_timestamp_after_failed_attempt"; - const testDB = primary.getDB(dbName); - const testColl = testDB.getCollection(collName); +const dbName = "test"; +const collName = "initial_sync_reset_oldest_timestamp_after_failed_attempt"; +const testDB = primary.getDB(dbName); +const testColl = testDB.getCollection(collName); - assert.commandWorked(testColl.insert({_id: 1})); +assert.commandWorked(testColl.insert({_id: 1})); - const session = primary.startSession(); - const sessionDB = session.getDatabase(dbName); - const sessionColl = sessionDB.getCollection(collName); - session.startTransaction(); - assert.commandWorked(sessionColl.insert({_id: 2})); +const session = primary.startSession(); +const sessionDB = session.getDatabase(dbName); +const sessionColl = sessionDB.getCollection(collName); +session.startTransaction(); +assert.commandWorked(sessionColl.insert({_id: 2})); - // This will be the begin fetching point for both initial sync attempts. After the first initial - // sync attempt fails, if the oldest timestamp isn't reset before the next attempt, the update - // to the transaction table for this prepare will fail a WiredTiger assertion that the commit - // timestamp for a storage transaction cannot be older than the oldest timestamp. - const prepareTimestamp = PrepareHelpers.prepareTransaction(session); +// This will be the begin fetching point for both initial sync attempts. After the first initial +// sync attempt fails, if the oldest timestamp isn't reset before the next attempt, the update +// to the transaction table for this prepare will fail a WiredTiger assertion that the commit +// timestamp for a storage transaction cannot be older than the oldest timestamp. +const prepareTimestamp = PrepareHelpers.prepareTransaction(session); - jsTestLog("Prepared a transaction at timestamp: " + prepareTimestamp); +jsTestLog("Prepared a transaction at timestamp: " + prepareTimestamp); - replTest.stop(secondary, undefined, {skipValidation: true}); - secondary = replTest.start( - secondary, - { - startClean: true, - setParameter: { - // Set the number of operations per batch to be 1 so that we can know exactly how - // many batches there will be. - "replBatchLimitOperations": 1, - "failpoint.initialSyncHangAfterDataCloning": tojson({mode: "alwaysOn"}), - // Allow the syncing node to write the prepare oplog entry and apply the first update - // before failing initial sync. - "failpoint.failInitialSyncBeforeApplyingBatch": tojson({mode: {skip: 2}}), - } - }, - true /* wait */); +replTest.stop(secondary, undefined, {skipValidation: true}); +secondary = replTest.start( + secondary, + { + startClean: true, + setParameter: { + // Set the number of operations per batch to be 1 so that we can know exactly how + // many batches there will be. + "replBatchLimitOperations": 1, + "failpoint.initialSyncHangAfterDataCloning": tojson({mode: "alwaysOn"}), + // Allow the syncing node to write the prepare oplog entry and apply the first update + // before failing initial sync. + "failpoint.failInitialSyncBeforeApplyingBatch": tojson({mode: {skip: 2}}), + } + }, + true /* wait */); - // Wait for failpoint to be reached so we know that collection cloning is paused. - checkLog.contains(secondary, "initialSyncHangAfterDataCloning fail point enabled"); +// Wait for failpoint to be reached so we know that collection cloning is paused. +checkLog.contains(secondary, "initialSyncHangAfterDataCloning fail point enabled"); - jsTestLog("Running operations while collection cloning is paused"); +jsTestLog("Running operations while collection cloning is paused"); - // This command will be in the last batch applied before the first initial sync attempt fails. - // If the oldest timestamp isn't reset on the next attempt, then the timestamp for this update - // will be the oldest timestamp. - assert.commandWorked(testColl.update({_id: 1}, {_id: 1, a: 1})); +// This command will be in the last batch applied before the first initial sync attempt fails. +// If the oldest timestamp isn't reset on the next attempt, then the timestamp for this update +// will be the oldest timestamp. +assert.commandWorked(testColl.update({_id: 1}, {_id: 1, a: 1})); - // This entry will be applied in its own batch, so the failInitialSyncBeforeApplyingBatch - // failpoint will cause the first initial sync attempt to fail before applying this. - assert.commandWorked(testColl.update({_id: 1}, {_id: 1, b: 2})); +// This entry will be applied in its own batch, so the failInitialSyncBeforeApplyingBatch +// failpoint will cause the first initial sync attempt to fail before applying this. +assert.commandWorked(testColl.update({_id: 1}, {_id: 1, b: 2})); - jsTestLog("Resuming initial sync"); +jsTestLog("Resuming initial sync"); - assert.commandWorked(secondary.adminCommand( - {configureFailPoint: "initialSyncHangAfterDataCloning", mode: "off"})); +assert.commandWorked( + secondary.adminCommand({configureFailPoint: "initialSyncHangAfterDataCloning", mode: "off"})); - // Wait for this failpoint to be hit before turning it off and causing initial sync to fail. - checkLog.contains(secondary, "failInitialSyncBeforeApplyingBatch fail point enabled"); +// Wait for this failpoint to be hit before turning it off and causing initial sync to fail. +checkLog.contains(secondary, "failInitialSyncBeforeApplyingBatch fail point enabled"); - jsTestLog("Failing first initial sync attempt"); +jsTestLog("Failing first initial sync attempt"); - // Turn the failpoint off and cause initial sync to fail. - assert.commandWorked(secondary.adminCommand( - {configureFailPoint: "failInitialSyncBeforeApplyingBatch", mode: "off"})); +// Turn the failpoint off and cause initial sync to fail. +assert.commandWorked(secondary.adminCommand( + {configureFailPoint: "failInitialSyncBeforeApplyingBatch", mode: "off"})); - replTest.waitForState(secondary, ReplSetTest.State.SECONDARY); +replTest.waitForState(secondary, ReplSetTest.State.SECONDARY); - jsTestLog("Initial sync completed"); +jsTestLog("Initial sync completed"); - assert.commandWorked(session.abortTransaction_forTesting()); +assert.commandWorked(session.abortTransaction_forTesting()); - replTest.stopSet(); +replTest.stopSet(); })();
\ No newline at end of file |