summaryrefslogtreecommitdiff
path: root/jstests
diff options
context:
space:
mode:
authorMoustafa Maher <m.maher@10gen.com>2021-08-04 18:56:52 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-08-05 18:28:24 +0000
commit4e2523128f38b1964a3ea55669af1fc8f7b26b34 (patch)
treeda537ab352e2810d456a3592f402248374cd51d4 /jstests
parent0d2789815060cf2d7ac511cf6a1be966243b5e84 (diff)
downloadmongo-4e2523128f38b1964a3ea55669af1fc8f7b26b34.tar.gz
SERVER-56845 Wait for the config to reach to all nodes after adding new node in implicit_default_write_concern_add_shard.js
Diffstat (limited to 'jstests')
-rw-r--r--jstests/sharding/implicit_default_write_concern_add_shard.js8
1 files changed, 7 insertions, 1 deletions
diff --git a/jstests/sharding/implicit_default_write_concern_add_shard.js b/jstests/sharding/implicit_default_write_concern_add_shard.js
index 69749948240..fafa784eebf 100644
--- a/jstests/sharding/implicit_default_write_concern_add_shard.js
+++ b/jstests/sharding/implicit_default_write_concern_add_shard.js
@@ -12,11 +12,17 @@ load("jstests/replsets/rslib.js"); // For reconfig and isConfigCommitted.
function addNonArbiterNode(nodeId, rst) {
const config = rst.getReplSetConfigFromNode();
config.members.push({_id: nodeId, host: rst.add().host});
- config.version++;
reconfig(rst, config);
assert.soon(() => isConfigCommitted(rst.getPrimary()));
rst.waitForConfigReplication(rst.getPrimary());
rst.awaitReplication();
+ // When we add a new node to a replica set, we temporarily add the "newlyAdded" field so that it
+ // is non-voting until it completes initial sync.
+ // This waits for the primary to see that the node has transitioned to a secondary, recovering,
+ // or rollback state to ensure that we can do the automatic reconfig to remove the "newlyAdded"
+ // field so that the node can actually vote so replication coordinator can update implicit
+ // default write-concern depending on the newly added voting member.
+ rst.waitForAllNewlyAddedRemovals();
}
function testAddShard(CWWCSet, isPSASet, fixAddShard) {