summaryrefslogtreecommitdiff
path: root/jstests/replsets/initial_sync2.js
diff options
context:
space:
mode:
authorKristina <kristina@10gen.com>2010-12-27 18:53:06 -0500
committerKristina <kristina@10gen.com>2010-12-27 18:53:11 -0500
commita6fba448b2f85b4cb7f299c151973337d9925e40 (patch)
treecd1e85c2d6598aea428810c47129702aab67a792 /jstests/replsets/initial_sync2.js
parente08ccea99f02bea43d5e84f10db10810ffa31ac7 (diff)
downloadmongo-a6fba448b2f85b4cb7f299c151973337d9925e40.tar.gz
allow initial sync when primary is down
Diffstat (limited to 'jstests/replsets/initial_sync2.js')
-rw-r--r--jstests/replsets/initial_sync2.js22
1 files changed, 10 insertions, 12 deletions
diff --git a/jstests/replsets/initial_sync2.js b/jstests/replsets/initial_sync2.js
index 80962a633e6..cb929296562 100644
--- a/jstests/replsets/initial_sync2.js
+++ b/jstests/replsets/initial_sync2.js
@@ -8,7 +8,7 @@
* 5. Freeze #2
* 6. Bring up #3
* 7. Kill #1 in the middle of syncing
- * 8. Check that #1 doesn't make it into secondary state for a while
+ * 8. Check that #3 makes it into secondary state
* 9. Bring #1 back up
* 10. Initial sync should succeed
* 11. Insert some stuff
@@ -99,17 +99,15 @@ print("7. Kill #1 in the middle of syncing");
replTest.stop(0);
-print("8. Check that #3 doesn't make it into secondary state for a while");
-for (var i=0; i<100; i++) {
- var status = admin_s2.runCommand({replSetGetStatus:1});
- occasionally(function() { printjson(status);}, 10);
- assert(status.members[2].state != 2);
- if (status.members[2].state == 1) {
- print("#3 completed its initial sync, we should just stop");
- return;
- }
- sleep(1000);
-}
+print("8. Check that #3 makes it into secondary state");
+wait(function() {
+ var status = admin_s2.runCommand({replSetGetStatus:1});
+ occasionally(function() { printjson(status);}, 10);
+ if (status.members[2].state == 2 || status.members[2].state == 1) {
+ return true;
+ }
+ return false;
+ });
print("9. Bring #1 back up");