diff options
author | William Schultz <william.schultz@mongodb.com> | 2019-09-03 19:32:47 +0000 |
---|---|---|
committer | evergreen <evergreen@mongodb.com> | 2019-09-03 19:32:47 +0000 |
commit | c926176630da106f30b84f69cba036c2e4963758 (patch) | |
tree | e13f866a8483a46a842fd5eede743282186ff5cc /jstests | |
parent | 938fbf14f2b5e4a0bfa84d8f71d4b6fbb26b2264 (diff) | |
download | mongo-c926176630da106f30b84f69cba036c2e4963758.tar.gz |
SERVER-41221 rollback_after_enabling_majority_reads.js test should make sure the final rollback occurs on node 0
Diffstat (limited to 'jstests')
-rw-r--r-- | jstests/replsets/rollback_after_enabling_majority_reads.js | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/jstests/replsets/rollback_after_enabling_majority_reads.js b/jstests/replsets/rollback_after_enabling_majority_reads.js index 6f33afa7138..92d783a8968 100644 --- a/jstests/replsets/rollback_after_enabling_majority_reads.js +++ b/jstests/replsets/rollback_after_enabling_majority_reads.js @@ -11,6 +11,7 @@ "use strict"; load("jstests/replsets/libs/rollback_test.js"); +load("jstests/libs/write_concern_util.js"); TestData.rollbackShutdowns = true; const name = "rollback_after_enabling_majority_reads"; @@ -27,7 +28,7 @@ config.settings = { chainingAllowed: false }; replTest.initiate(config); -const rollbackTest = new RollbackTest(name, replTest); +let rollbackTest = new RollbackTest(name, replTest); jsTest.log("Ensure the stable timestamp is ahead of the common point on the rollback node."); const rollbackNode = rollbackTest.transitionToRollbackOperations(); @@ -72,6 +73,22 @@ assert.eq(1, rollbackNode.getDB(dbName)[collName].find({_id: "steady state op"}) jsTest.log("Restart the rollback node with enableMajorityReadConcern=true."); rollbackTest.restartNode(0, 15, {enableMajorityReadConcern: "true"}); +// Make sure node 0 is the primary. +let node = replTest.nodes[0]; +jsTestLog("Waiting for node " + node.host + " to become primary."); +replTest.awaitNodesAgreeOnPrimary(); +assert.commandWorked(node.adminCommand({replSetStepUp: 1})); +replTest.waitForState(node, ReplSetTest.State.PRIMARY); +assert.eq(replTest.getPrimary(), node, node.host + " was not primary after step up."); + +// Restart replication on the tiebreaker node before constructing a new RollbackTest. +restartServerReplication(replTest.nodes[2]); + +// Create a new RollbackTest fixture to execute the final rollback. This will guarantee that the +// final rollback occurs on the current primary, which should be node 0. +jsTestLog("Creating a new RollbackTest fixture to execute a final rollback."); +rollbackTest = new RollbackTest(name, replTest); + jsTest.log("Rollback should succeed since the common point is at least the stable timestamp."); rollbackTest.transitionToRollbackOperations(); rollbackTest.transitionToSyncSourceOperationsBeforeRollback(); |