summaryrefslogtreecommitdiff
path: root/jstests/replsets/remove_newly_added_field_after_finishing_initial_sync.js
diff options
context:
space:
mode:
authorJudah Schvimer <judah@mongodb.com>2020-06-08 23:20:37 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-07-09 22:39:43 +0000
commit64fcdabe8c7cc38188f31fd606379f935c94555a (patch)
tree8dbc2fc938b52f9c7f410abff410d30beaeaeceb /jstests/replsets/remove_newly_added_field_after_finishing_initial_sync.js
parent915402884c52da861b1660cd6a7172c552ce1806 (diff)
downloadmongo-64fcdabe8c7cc38188f31fd606379f935c94555a.tar.gz
SERVER-46541 enable automatic reconfigs for initial sync semantics by default
Diffstat (limited to 'jstests/replsets/remove_newly_added_field_after_finishing_initial_sync.js')
-rw-r--r--jstests/replsets/remove_newly_added_field_after_finishing_initial_sync.js25
1 files changed, 11 insertions, 14 deletions
diff --git a/jstests/replsets/remove_newly_added_field_after_finishing_initial_sync.js b/jstests/replsets/remove_newly_added_field_after_finishing_initial_sync.js
index bc9a4f048e0..a8198a1bd84 100644
--- a/jstests/replsets/remove_newly_added_field_after_finishing_initial_sync.js
+++ b/jstests/replsets/remove_newly_added_field_after_finishing_initial_sync.js
@@ -22,7 +22,6 @@ const collName = "testcoll";
const rst = new ReplSetTest({
name: testName,
nodes: [{}, {}, {rsConfig: {priority: 0}}],
- nodeOptions: {setParameter: {enableAutomaticReconfig: true}},
settings: {chainingAllowed: false},
useBridge: true
});
@@ -33,12 +32,6 @@ const primary = rst.getPrimary();
const primaryDb = primary.getDB(dbName);
const primaryColl = primaryDb.getCollection(collName);
-// TODO (SERVER-46808): Move this into ReplSetTest.initiate
-waitForNewlyAddedRemovalForNodeToBeCommitted(primary, 0);
-waitForNewlyAddedRemovalForNodeToBeCommitted(primary, 1);
-waitForNewlyAddedRemovalForNodeToBeCommitted(primary, 2);
-waitForConfigReplication(primary, rst.nodes);
-
// We did two automatic reconfigs to remove 'newlyAdded' fields (for members 1 and 2).
const replMetricsAtStart = primaryDb.serverStatus().metrics.repl;
assert(replMetricsAtStart.hasOwnProperty("reconfig"));
@@ -55,7 +48,6 @@ const secondary = rst.add({
setParameter: {
'failpoint.initialSyncHangBeforeFinish': tojson({mode: 'alwaysOn'}),
'numInitialSyncAttempts': 1,
- 'enableAutomaticReconfig': true,
}
});
rst.reInitiate();
@@ -73,6 +65,11 @@ let getConfigRes = assert.commandWorked(primary.adminCommand({replSetGetConfig:
let newNodeRes = getConfigRes.members[3];
assert.eq(false, newNodeRes.hasOwnProperty("newlyAdded"), getConfigRes);
+jsTestLog("Making sure the 'newlyAdded' field is visible in replSetGetConfig with test param");
+getConfigRes = getConfigWithNewlyAdded(primary).config;
+newNodeRes = getConfigRes.members[3];
+assert.eq(true, newNodeRes.hasOwnProperty("newlyAdded"), getConfigRes);
+
jsTestLog("Checking behavior with 'newlyAdded' field set, during initial sync");
assertVoteCount(primary, {
votingMembersCount: 3,
@@ -97,13 +94,13 @@ assert.commandWorked(primaryColl.insert({a: 3}, {writeConcern: {w: "majority"}})
// Only two nodes are needed for an election (0 and 1).
assert.commandWorked(rst.nodes[1].adminCommand({replSetStepUp: 1}));
assert.eq(rst.getPrimary(), rst.nodes[1]);
-waitForConfigReplication(rst.nodes[1], [rst.nodes[0], rst.nodes[1], rst.nodes[3]]);
+rst.waitForConfigReplication(rst.nodes[1], [rst.nodes[0], rst.nodes[1], rst.nodes[3]]);
// Reset node 0 to be primary.
rst.awaitReplication(null, null, [rst.nodes[0], rst.nodes[1]]);
assert.commandWorked(rst.nodes[0].adminCommand({replSetStepUp: 1}));
assert.eq(rst.getPrimary(), rst.nodes[0]);
-waitForConfigReplication(rst.nodes[0], [rst.nodes[0], rst.nodes[1], rst.nodes[3]]);
+rst.waitForConfigReplication(rst.nodes[0], [rst.nodes[0], rst.nodes[1], rst.nodes[3]]);
// Initial syncing nodes do not acknowledge replication.
rst.nodes[1].disconnect(rst.nodes);
@@ -153,13 +150,13 @@ assert.commandWorked(primaryColl.insert({a: 6}, {writeConcern: {w: "majority"}})
// Only two nodes are needed for an election (0 and 1).
assert.commandWorked(rst.nodes[1].adminCommand({replSetStepUp: 1}));
assert.eq(rst.getPrimary(), rst.nodes[1]);
-waitForConfigReplication(rst.nodes[1], [rst.nodes[0], rst.nodes[1]]);
+rst.waitForConfigReplication(rst.nodes[1], [rst.nodes[0], rst.nodes[1]]);
// Reset node 0 to be primary.
rst.awaitReplication(null, null, [rst.nodes[0], rst.nodes[1]]);
assert.commandWorked(rst.nodes[0].adminCommand({replSetStepUp: 1}));
assert.eq(rst.getPrimary(), rst.nodes[0]);
-waitForConfigReplication(rst.nodes[0], [rst.nodes[0], rst.nodes[1]]);
+rst.waitForConfigReplication(rst.nodes[0], [rst.nodes[0], rst.nodes[1]]);
// 'newlyAdded' nodes cannot be one of the two nodes to satisfy w:majority.
rst.nodes[3].reconnect(rst.nodes);
@@ -217,13 +214,13 @@ assert.commandWorked(primaryColl.insert({a: 8}, {writeConcern: {w: "majority"}})
// Only three nodes are needed for an election (0, 1, and 3).
assert.commandWorked(rst.nodes[1].adminCommand({replSetStepUp: 1}));
assert.eq(rst.getPrimary(), rst.nodes[1]);
-waitForConfigReplication(rst.nodes[1], [rst.nodes[0], rst.nodes[1], rst.nodes[3]]);
+rst.waitForConfigReplication(rst.nodes[1], [rst.nodes[0], rst.nodes[1], rst.nodes[3]]);
// Reset node 0 to be primary.
rst.awaitReplication(null, null, [rst.nodes[0], rst.nodes[1]]);
assert.commandWorked(rst.nodes[0].adminCommand({replSetStepUp: 1}));
assert.eq(rst.getPrimary(), rst.nodes[0]);
-waitForConfigReplication(rst.nodes[0], [rst.nodes[0], rst.nodes[1], rst.nodes[3]]);
+rst.waitForConfigReplication(rst.nodes[0], [rst.nodes[0], rst.nodes[1], rst.nodes[3]]);
// 3 nodes are needed for a w:majority write.
rst.nodes[3].disconnect(rst.nodes);