summaryrefslogtreecommitdiff
path: root/jstests/replsets/sync_passive.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/replsets/sync_passive.js')
-rw-r--r--jstests/replsets/sync_passive.js28
1 files changed, 9 insertions, 19 deletions
diff --git a/jstests/replsets/sync_passive.js b/jstests/replsets/sync_passive.js
index 76db6a4f838..4899385563f 100644
--- a/jstests/replsets/sync_passive.js
+++ b/jstests/replsets/sync_passive.js
@@ -18,8 +18,8 @@ load("jstests/replsets/rslib.js");
var name = "sync_passive";
var host = getHostName();
-
-var replTest = new ReplSetTest( {name: name, nodes: 3} );
+
+var replTest = new ReplSetTest({name: name, nodes: 3});
var nodes = replTest.startSet();
@@ -27,7 +27,7 @@ var nodes = replTest.startSet();
var config = replTest.getReplSetConfig();
config.members[0].priority = 2;
config.members[2].priority = 0;
-
+
replTest.initiate(config);
replTest.waitForState(replTest.nodes[0], ReplSetTest.State.PRIMARY, 60 * 1000);
@@ -36,56 +36,46 @@ var server0 = master;
var server1 = replTest.liveNodes.slaves[0];
print("Initial sync");
-for (var i=0;i<100;i++) {
- master.foo.insert({x:i});
+for (var i = 0; i < 100; i++) {
+ master.foo.insert({x: i});
}
replTest.awaitReplication();
-
print("stop #1");
replTest.stop(1);
-
print("add some data");
-for (var i=0;i<1000;i++) {
- master.bar.insert({x:i});
+for (var i = 0; i < 1000; i++) {
+ master.bar.insert({x: i});
}
replTest.awaitReplication();
-
print("stop #0");
replTest.stop(0);
-
print("restart #1");
replTest.restart(1);
-
print("check sync");
replTest.awaitReplication(60 * 1000);
-
print("add data");
reconnect(server1);
master = replTest.getPrimary().getDB("test");
-for (var i=0;i<1000;i++) {
- master.bar.insert({x:i});
+for (var i = 0; i < 1000; i++) {
+ master.bar.insert({x: i});
}
replTest.awaitReplication();
-
print("kill #1");
replTest.stop(1);
-
print("restart #0");
replTest.restart(0);
reconnect(server0);
-
print("wait for sync");
replTest.awaitReplication();
-
print("bring #1 back up, make sure everything's okay");
replTest.restart(1);