diff options
author | Dan Pasette <dan@10mongodb.com> | 2014-03-14 17:40:15 -0400 |
---|---|---|
committer | Dan Pasette <dan@mongodb.com> | 2014-03-15 14:26:35 -0400 |
commit | 63583514f11f910c132e91dadbdc18a9f37adade (patch) | |
tree | a1fad025a9fe932cf6fc38c66464a06a0e200761 /jstests/replsets | |
parent | 2ab0b308b4d1c045aad6d43faf77a5584892f8da (diff) | |
download | mongo-63583514f11f910c132e91dadbdc18a9f37adade.tar.gz |
SERVER-12901 make test pause maxSyncSourceLagSecs
Diffstat (limited to 'jstests/replsets')
-rw-r--r-- | jstests/replsets/maxSyncSourceLagSecs.js | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/jstests/replsets/maxSyncSourceLagSecs.js b/jstests/replsets/maxSyncSourceLagSecs.js index d50f2126115..934dbf50915 100644 --- a/jstests/replsets/maxSyncSourceLagSecs.js +++ b/jstests/replsets/maxSyncSourceLagSecs.js @@ -1,38 +1,36 @@ // Test that setting maxSyncSourceLagSecs causes the set to change sync target var replTest = new ReplSetTest({ nodes: 3, oplogSize: 5, - nodeOptions: {setParameter: "maxSyncSourceLagSecs=5"}}); + nodeOptions: {setParameter: "maxSyncSourceLagSecs=3"}}); replTest.startSet(); replTest.initiate(); var master = replTest.getMaster(); -var docNum = 100; -for (i=0; i<docNum; i++) { - master.getDB("foo").bar.save({a: i}); -} +master.getDB("foo").bar.save({a: 1}); replTest.awaitReplication(); var slaves = replTest.liveNodes.slaves; +// need to put at least maxSyncSourceLagSecs b/w first op and subsequent ops +// so that the shouldChangeSyncSource logic goes into effect +sleep(3000); + jsTestLog("Setting sync target of slave 2 to slave 1"); assert.commandWorked(slaves[1].getDB("admin").runCommand({replSetSyncFrom: slaves[0].name})); assert.soon(function() { return (replTest.status().members[2].syncingTo == slaves[0].name); }, "sync target not changed to other slave"); -printjson(replTest.status); +printjson(replTest.status()); jsTestLog("Lock slave 1 and add some docs. Force sync target for slave 2 to change to primary"); assert.commandWorked(slaves[0].getDB("admin").runCommand({fsync:1, lock: 1})); -var docNum = 100; -for (var i=0; i<docNum; i++) { - master.getDB("foo").bar.save({a: i}); -} +master.getDB("foo").bar.save({a: 2}); assert.soon(function() { return (replTest.status().members[2].syncingTo == master.name); }, "sync target not changed back to primary"); -printjson(replTest.status); +printjson(replTest.status()); assert.soon(function() { - return (slaves[1].getDB("foo").bar.count() == 200); + return (slaves[1].getDB("foo").bar.count() == 2); }, "slave should have caught up after syncing to primary."); assert.commandWorked(slaves[0].getDB("admin").$cmd.sys.unlock.findOne()); |