summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVesselina Ratcheva <vesselina.ratcheva@10gen.com>2020-05-08 14:56:26 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-05-08 21:35:40 +0000
commit29b6b556d05ff1bd752e9cb735f5891d57ebab0d (patch)
treec6d07a1eb56a7719ea319f014e9788754b4873ce
parent8a3fd1364c4adba0cdb687e54a3bdbdefa6863c1 (diff)
downloadmongo-29b6b556d05ff1bd752e9cb735f5891d57ebab0d.tar.gz
SERVER-47823 Wait for members to have latest configs after elections in remove_newly_added_field_after_finishing_initial_sync.js
-rw-r--r--jstests/replsets/remove_newly_added_field_after_finishing_initial_sync.js9
1 files changed, 9 insertions, 0 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 a76b3332731..4d333cbd189 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
@@ -102,11 +102,14 @@ 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]]);
// 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]]);
// Initial syncing nodes do not acknowledge replication.
rst.nodes[1].disconnect(rst.nodes);
@@ -154,11 +157,14 @@ 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]]);
// 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]]);
// 'newlyAdded' nodes cannot be one of the two nodes to satisfy w:majority.
rst.nodes[3].reconnect(rst.nodes);
@@ -215,11 +221,14 @@ rst.nodes[2].disconnect(rst.nodes);
// 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]]);
// 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]]);
// 3 nodes are needed for a w:majority write.
rst.nodes[3].disconnect(rst.nodes);