summaryrefslogtreecommitdiff
path: root/jstests/slow1
diff options
context:
space:
mode:
authorSiyuan Zhou <siyuan.zhou@mongodb.com>2020-02-28 17:45:21 -0500
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-03-03 09:08:42 +0000
commit07302cd28d7dce013f9df1ba2f5fcf70e506bce5 (patch)
treeafd1e2b0aae7a3e2d390324f4cd0018847c93b3f /jstests/slow1
parentac9b65c8c5c828e7da56562823fe25158a387aa2 (diff)
downloadmongo-07302cd28d7dce013f9df1ba2f5fcf70e506bce5.tar.gz
SERVER-45081 Increment config term via reconfig on stepup.
Diffstat (limited to 'jstests/slow1')
-rw-r--r--jstests/slow1/replsets_priority1.js52
1 files changed, 17 insertions, 35 deletions
diff --git a/jstests/slow1/replsets_priority1.js b/jstests/slow1/replsets_priority1.js
index fb1a46bcddb..66d3780770d 100644
--- a/jstests/slow1/replsets_priority1.js
+++ b/jstests/slow1/replsets_priority1.js
@@ -89,21 +89,21 @@ var checkPrimaryIs = function(node) {
everyoneOkSoon();
-print("\n\nreplsets_priority1.js initial sync");
+jsTestLog("replsets_priority1.js initial sync");
// intial sync
master.getDB("foo").bar.insert({x: 1});
rs.awaitReplication();
-print("\n\nreplsets_priority1.js starting loop");
+jsTestLog("replsets_priority1.js starting loop");
var n = 5;
for (var i = 0; i < n; i++) {
- print("Round " + i + ": FIGHT!");
+ jsTestLog("Round " + i + ": FIGHT!");
var max = null;
var second = null;
- reconnect(master);
+ master = rs.getPrimary();
var config = master.getDB("local").system.replset.findOne();
var version = config.version;
@@ -128,38 +128,20 @@ for (var i = 0; i < n; i++) {
}
}
- print("\n\nreplsets_priority1.js max is " + max.host + " with priority " + max.priority +
- ", reconfiguring...");
-
- var count = 0;
- while (config.version != version && count < 100) {
- reconnect(master);
-
- occasionally(function() {
- print("version is " + version + ", trying to update to " + config.version);
- });
-
- try {
- master.adminCommand({replSetReconfig: config});
- master = rs.getPrimary();
- reconnect(master);
-
- version = master.getDB("local").system.replset.findOne().version;
- } catch (e) {
- print("nreplsets_priority1.js Caught exception: " + e);
- }
+ jsTestLog("replsets_priority1.js max is " + max.host + " with priority " + max.priority +
+ ", reconfiguring on " + master.host);
- count++;
- }
+ assert.soon(() => isConfigCommitted(master));
+ assert.commandWorked(master.adminCommand({replSetReconfig: config}));
- print("\nreplsets_priority1.js wait for 2 slaves");
+ jsTestLog("replsets_priority1.js wait for 2 slaves");
assert.soon(function() {
rs.getPrimary();
return rs._slaves.length == 2;
}, "2 slaves");
- print("\nreplsets_priority1.js wait for new config version " + config.version);
+ jsTestLog("replsets_priority1.js wait for new config version " + config.version);
assert.soon(function() {
var versions = [0, 0];
@@ -170,28 +152,28 @@ for (var i = 0; i < n; i++) {
return versions[0] == config.version && versions[1] == config.version;
});
- print("replsets_priority1.js awaitReplication");
+ jsTestLog("replsets_priority1.js awaitReplication");
// the reconfiguration needs to be replicated! the hb sends it out
// separately from the repl
rs.awaitReplication();
- print("reconfigured. Checking statuses.");
+ jsTestLog("reconfigured. Checking statuses.");
checkPrimaryIs(max);
// Wait for election oplog entry to be replicated, to avoid rollbacks later on.
rs.awaitReplication();
- print("rs.stop");
+ jsTestLog("rs.stop");
rs.stop(max._id);
master = rs.getPrimary();
- print("\nkilled max primary. Checking statuses.");
+ jsTestLog("killed max primary. Checking statuses.");
- print("second is " + second.host + " with priority " + second.priority);
+ jsTestLog("second is " + second.host + " with priority " + second.priority);
checkPrimaryIs(second);
// Wait for election oplog entry to be replicated, to avoid rollbacks later on.
@@ -200,12 +182,12 @@ for (var i = 0; i < n; i++) {
});
rs.awaitReplication(null, null, liveSlaves);
- print("restart max " + max._id);
+ jsTestLog("restart max " + max._id);
rs.restart(max._id);
master = rs.getPrimary();
- print("max restarted. Checking statuses.");
+ jsTestLog("max restarted. Checking statuses.");
checkPrimaryIs(max);
// Wait for election oplog entry to be replicated, to avoid rollbacks later on.