summaryrefslogtreecommitdiff
path: root/jstests/replsets/disallow_adding_initialized_node1.js
diff options
context:
space:
mode:
authorA. Jesse Jiryu Davis <jesse@mongodb.com>2020-09-21 08:48:50 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-09-21 13:17:03 +0000
commit418c61279986a5eaddc66a16b5e288556ad1f6d3 (patch)
treeb56c929fe926d0888c1b1b4d44e12a0a3e18e9d1 /jstests/replsets/disallow_adding_initialized_node1.js
parent2cdeee7b845751e7e50b2a5a78641ba4b4680aa2 (diff)
downloadmongo-418c61279986a5eaddc66a16b5e288556ad1f6d3.tar.gz
SERVER-35649 Retry DNS failures during reconfig
Diffstat (limited to 'jstests/replsets/disallow_adding_initialized_node1.js')
-rw-r--r--jstests/replsets/disallow_adding_initialized_node1.js25
1 files changed, 16 insertions, 9 deletions
diff --git a/jstests/replsets/disallow_adding_initialized_node1.js b/jstests/replsets/disallow_adding_initialized_node1.js
index bc6d3ed764a..2a9775e4e38 100644
--- a/jstests/replsets/disallow_adding_initialized_node1.js
+++ b/jstests/replsets/disallow_adding_initialized_node1.js
@@ -12,7 +12,8 @@ var replSetA = new ReplSetTest({
name: name,
nodes: [
{rsConfig: {_id: 10}},
- ]
+ ],
+ nodeOptions: {setParameter: {logComponentVerbosity: tojsononeline({replication: 2})}}
});
replSetA.startSet({dbpath: "$set-A-$node"});
replSetA.initiate();
@@ -21,7 +22,8 @@ var replSetB = new ReplSetTest({
name: name,
nodes: [
{rsConfig: {_id: 20}},
- ]
+ ],
+ nodeOptions: {setParameter: {logComponentVerbosity: tojsononeline({replication: 2})}}
});
replSetB.startSet({dbpath: "$set-B-$node"});
replSetB.initiate();
@@ -54,14 +56,19 @@ configA.version++;
configA.members.push({_id: 11, host: primaryB.host, votes: 0, priority: 0});
assert.commandWorked(primaryA.adminCommand({replSetReconfig: configA}));
-// Wait for primary A to report primary B down. B should reject all heartbeats from A due to a
-// replset name mismatch, leading A to consider it down.
+// Wait for primary A to report primary B UNKNOWN.
assert.soon(function() {
const statusA = assert.commandWorked(primaryA.adminCommand({replSetGetStatus: 1}));
if (statusA.members.length !== 2) {
return false;
}
- return statusA.members[1].state === ReplSetTest.State.DOWN;
+ return statusA.members[1].state === ReplSetTest.State.UNKNOWN;
+});
+
+checkLog.containsJson(primaryA, 4615621, {
+ error: (error) => {
+ return error.code === 93 && error.errmsg.indexOf("replica set IDs do not match") !== -1;
+ }
});
// Confirm that each set still has the correct primary.
@@ -72,7 +79,7 @@ jsTestLog('After merging with 0 votes: primary A = ' + newPrimaryA.host +
assert.eq(primaryA, newPrimaryA);
assert.eq(primaryB, newPrimaryB);
-// Replica set A's config should include primary B and consider it DOWN.
+// Replica set A's config should include primary B and consider it UNKNOWN.
let statusA = assert.commandWorked(primaryA.adminCommand({replSetGetStatus: 1}));
jsTestLog('After merging with 0 votes: replica set status A = ' + tojson(statusA));
assert.eq(2, statusA.members.length);
@@ -81,7 +88,7 @@ assert.eq(primaryA.host, statusA.members[0].name);
assert.eq(ReplSetTest.State.PRIMARY, statusA.members[0].state);
assert.eq(11, statusA.members[1]._id);
assert.eq(primaryB.host, statusA.members[1].name);
-assert.eq(ReplSetTest.State.DOWN, statusA.members[1].state);
+assert.eq(ReplSetTest.State.UNKNOWN, statusA.members[1].state);
// Replica set B's config should remain unchanged.
let statusB = assert.commandWorked(primaryB.adminCommand({replSetGetStatus: 1}));
@@ -115,7 +122,7 @@ var msgB = "replica set IDs do not match, ours: " + configB.settings.replicaSetI
"; remote node's: " + configA.settings.replicaSetId;
checkLog.contains(primaryB, msgB);
-// Confirm primary B is still DOWN.
+// Confirm primary B is still UNKNOWN.
statusA = assert.commandWorked(primaryA.adminCommand({replSetGetStatus: 1}));
jsTestLog('After merging: replica set status A = ' + tojson(statusA));
assert.eq(2, statusA.members.length);
@@ -124,7 +131,7 @@ assert.eq(primaryA.host, statusA.members[0].name);
assert.eq(ReplSetTest.State.PRIMARY, statusA.members[0].state);
assert.eq(11, statusA.members[1]._id);
assert.eq(primaryB.host, statusA.members[1].name);
-assert.eq(ReplSetTest.State.DOWN, statusA.members[1].state);
+assert.eq(ReplSetTest.State.UNKNOWN, statusA.members[1].state);
// Replica set B's config should remain unchanged.
statusB = assert.commandWorked(primaryB.adminCommand({replSetGetStatus: 1}));