diff options
author | Benety Goh <benety@mongodb.com> | 2016-11-07 14:28:24 -0500 |
---|---|---|
committer | Benety Goh <benety@mongodb.com> | 2016-11-07 15:54:09 -0500 |
commit | d4a7ae574011cf40e7785c439969904954e18db2 (patch) | |
tree | 1906f4d588ea4a841ebf123fa85e7e9928cb9af6 | |
parent | 9a0127c107c8b3f1e80453075848c4372a25e075 (diff) | |
download | mongo-d4a7ae574011cf40e7785c439969904954e18db2.tar.gz |
SERVER-26934 removed hardcoded ReplSetTest.awaitReplication timeouts from JS tests
-rw-r--r-- | jstests/multiVersion/mixed_storage_version_replication.js | 4 | ||||
-rw-r--r-- | jstests/noPassthrough/initial_sync_cloner_dups.js | 11 | ||||
-rw-r--r-- | jstests/noPassthroughWithMongod/indexbg_interrupts.js | 2 | ||||
-rw-r--r-- | jstests/replsets/catchup.js | 8 | ||||
-rw-r--r-- | jstests/replsets/initial_sync1.js | 2 | ||||
-rw-r--r-- | jstests/replsets/initial_sync2.js | 2 | ||||
-rw-r--r-- | jstests/replsets/linearizable_read_concern.js | 8 | ||||
-rw-r--r-- | jstests/replsets/replset5.js | 2 | ||||
-rw-r--r-- | jstests/replsets/replset9.js | 2 | ||||
-rw-r--r-- | jstests/replsets/sync_passive.js | 2 | ||||
-rw-r--r-- | jstests/sharding/auth.js | 4 | ||||
-rw-r--r-- | jstests/sharding/commands_that_write_accept_wc_configRS.js | 2 | ||||
-rw-r--r-- | jstests/sharding/shard_aware_on_set_shard_version.js | 2 | ||||
-rw-r--r-- | jstests/sharding/zbigMapReduce.js | 2 |
14 files changed, 26 insertions, 27 deletions
diff --git a/jstests/multiVersion/mixed_storage_version_replication.js b/jstests/multiVersion/mixed_storage_version_replication.js index 141d265e271..d62de1174b6 100644 --- a/jstests/multiVersion/mixed_storage_version_replication.js +++ b/jstests/multiVersion/mixed_storage_version_replication.js @@ -716,14 +716,14 @@ function doMultiThreadedWork(primary, numThreads) { highestPriority++; printjson(config); reconfig(replTest, config); - replTest.awaitReplication(60000); // 2 times the election period. + replTest.awaitReplication(); assert.soon(primaryChanged(replTest.nodes, replTest, primaryIndex), "waiting for higher priority primary to be elected", 100000); print("New primary elected, doing a bunch of work"); primary = replTest.getPrimary(); doMultiThreadedWork(primary, 10); - replTest.awaitReplication(50000); + replTest.awaitReplication(); print("Work done, checking to see all nodes match"); assertSameData(primary, replTest.nodes); } diff --git a/jstests/noPassthrough/initial_sync_cloner_dups.js b/jstests/noPassthrough/initial_sync_cloner_dups.js index 8b169332c8e..23b1b989400 100644 --- a/jstests/noPassthrough/initial_sync_cloner_dups.js +++ b/jstests/noPassthrough/initial_sync_cloner_dups.js @@ -17,7 +17,6 @@ Random.setRandomSeed(); - var awaitTimeout = 2 * 60 * 1000; // used to parse RAM log file var contains = function(logLines, func) { var i = logLines.length; @@ -36,7 +35,7 @@ conf.settings = {}; conf.settings.chainingAllowed = false; replTest.initiate(conf); - replTest.awaitSecondaryNodes(awaitTimeout); + replTest.awaitSecondaryNodes(); var primary = replTest.getPrimary(); var coll = primary.getDB('test').cloner; coll.drop(); @@ -51,7 +50,7 @@ } batch.execute(); - replTest.awaitReplication(awaitTimeout); + replTest.awaitReplication(); jsTestLog("Start remove/insert on primary"); var insertAndRemove = function(host) { @@ -81,7 +80,7 @@ jsTestLog("add a new secondary"); var secondary = replTest.add({}); - replTest.reInitiate(awaitTimeout * 2); + replTest.reInitiate(); secondary.setSlaveOk(); // Wait for the secondary to get ReplSetInitiate command. replTest.waitForState( @@ -112,8 +111,8 @@ worker.join(); // make sure all secondaries are caught up, after init sync reconnect(secondary.getDB("test")); - replTest.awaitSecondaryNodes(awaitTimeout); - replTest.awaitReplication(awaitTimeout); + replTest.awaitSecondaryNodes(); + replTest.awaitReplication(); jsTestLog("check that secondary has correct counts"); var secondaryColl = secondary.getDB('test').getCollection('cloner'); diff --git a/jstests/noPassthroughWithMongod/indexbg_interrupts.js b/jstests/noPassthroughWithMongod/indexbg_interrupts.js index 0a50951c75d..3e0601a9bce 100644 --- a/jstests/noPassthroughWithMongod/indexbg_interrupts.js +++ b/jstests/noPassthroughWithMongod/indexbg_interrupts.js @@ -89,7 +89,7 @@ for (var idx = 0; idx < dropAction.length; idx++) { assert.commandWorked(masterDB.runCommand(dc)); jsTest.log("Waiting on replication"); - replTest.awaitReplication(60 * 1000); + replTest.awaitReplication(); // we need to assert.soon because the drop only marks the index for removal // the removal itself is asynchronous and may take another moment before it happens diff --git a/jstests/replsets/catchup.js b/jstests/replsets/catchup.js index 8bf0bc08ead..407735bd604 100644 --- a/jstests/replsets/catchup.js +++ b/jstests/replsets/catchup.js @@ -96,14 +96,14 @@ load("jstests/replsets/rslib.js"); jsTest.log("Case 1: The primary is up-to-date after freshness scan."); // Should complete transition to primary immediately. - rst.awaitReplication(30000, ReplSetTest.OpTimeType.LAST_DURABLE); + rst.awaitReplication(ReplSetTest.kDefaultTimeoutMS, ReplSetTest.OpTimeType.LAST_DURABLE); var newPrimary = stepUp(rst.getSecondary()); rst.awaitNodesAgreeOnPrimary(); // Should win an election and finish the transition very quickly. assert.eq(newPrimary, rst.getPrimary()); jsTest.log("Case 2: The primary needs to catch up, succeeds in time."); - rst.awaitReplication(30000, ReplSetTest.OpTimeType.LAST_DURABLE); + rst.awaitReplication(ReplSetTest.kDefaultTimeoutMS, ReplSetTest.OpTimeType.LAST_DURABLE); // Write documents that cannot be replicated to secondaries in time. var originalSecondaries = rst.getSecondaries(); originalSecondaries.forEach(enableFailPoint); @@ -124,7 +124,7 @@ load("jstests/replsets/rslib.js"); checkOpInOplog(newPrimary, latestOp, 1); jsTest.log("Case 3: The primary needs to catch up, fails due to timeout."); - rst.awaitReplication(30000, ReplSetTest.OpTimeType.LAST_DURABLE); + rst.awaitReplication(ReplSetTest.kDefaultTimeoutMS, ReplSetTest.OpTimeType.LAST_DURABLE); // Write documents that cannot be replicated to secondaries in time. originalSecondaries = rst.getSecondaries(); originalSecondaries.forEach(enableFailPoint); @@ -152,7 +152,7 @@ load("jstests/replsets/rslib.js"); disableFailPoint(originalSecondaries[1]); jsTest.log("Case 4: The primary needs to catch up, but has to change sync source to catch up."); - rst.awaitReplication(30000, ReplSetTest.OpTimeType.LAST_DURABLE); + rst.awaitReplication(ReplSetTest.kDefaultTimeoutMS, ReplSetTest.OpTimeType.LAST_DURABLE); // Write documents that cannot be replicated to secondaries in time. rst.getSecondaries().forEach(enableFailPoint); doWrites(rst.getPrimary()); diff --git a/jstests/replsets/initial_sync1.js b/jstests/replsets/initial_sync1.js index 51d355d80c1..3087793dcd1 100644 --- a/jstests/replsets/initial_sync1.js +++ b/jstests/replsets/initial_sync1.js @@ -100,7 +100,7 @@ for (var i = 0; i < 100; i++) { assert.writeOK(bulk.execute()); print("11. Everyone happy eventually"); -replTest.awaitReplication(300000); +replTest.awaitReplication(); MongoRunner.stopMongod(slave2); replTest.stopSet(); diff --git a/jstests/replsets/initial_sync2.js b/jstests/replsets/initial_sync2.js index 69c91d30f04..b70dd71bb8f 100644 --- a/jstests/replsets/initial_sync2.js +++ b/jstests/replsets/initial_sync2.js @@ -96,7 +96,7 @@ var doTest = function() { replTest.waitForState(replTest.nodes[0], ReplSetTest.State.PRIMARY); jsTest.log("12. Everyone happy eventually"); - replTest.awaitReplication(2 * 60 * 1000); + replTest.awaitReplication(); replTest.stopSet(); }; diff --git a/jstests/replsets/linearizable_read_concern.js b/jstests/replsets/linearizable_read_concern.js index 4cbef17b568..58fe4de0bcc 100644 --- a/jstests/replsets/linearizable_read_concern.js +++ b/jstests/replsets/linearizable_read_concern.js @@ -43,10 +43,10 @@ load('jstests/libs/write_concern_util.js'); replTest.startSet(); replTest.initiate(config); - // We increase the awaitReplication timeout because without a sync source the heartbeat - // interval will be half of the election timeout, 30 seconds. It thus will take almost - // 30 seconds for the secondaries to set the primary as their sync source and begin replicating. - replTest.awaitReplication(90 * 1000); + // Without a sync source the heartbeat interval will be half of the election timeout, 30 + // seconds. It thus will take almost 30 seconds for the secondaries to set the primary as + // their sync source and begin replicating. + replTest.awaitReplication(); var primary = replTest.getPrimary(); var secondaries = replTest.getSecondaries(); diff --git a/jstests/replsets/replset5.js b/jstests/replsets/replset5.js index e0b4ed85994..25c073571f1 100644 --- a/jstests/replsets/replset5.js +++ b/jstests/replsets/replset5.js @@ -25,7 +25,7 @@ load("jstests/replsets/rslib.js"); // Initial replication master.getDB("barDB").bar.save({a: 1}); - replTest.awaitReplication(5 * 60 * 1000); + replTest.awaitReplication(); // These writes should be replicated immediately var docNum = 5000; diff --git a/jstests/replsets/replset9.js b/jstests/replsets/replset9.js index c1493908f12..960f24f46be 100644 --- a/jstests/replsets/replset9.js +++ b/jstests/replsets/replset9.js @@ -69,4 +69,4 @@ assert.writeOK(bulk.execute()); print("finished"); // Wait for replication to catch up. -rt.awaitReplication(640000); +rt.awaitReplication(); diff --git a/jstests/replsets/sync_passive.js b/jstests/replsets/sync_passive.js index c0be375b98b..321a198e9af 100644 --- a/jstests/replsets/sync_passive.js +++ b/jstests/replsets/sync_passive.js @@ -57,7 +57,7 @@ print("restart #1"); replTest.restart(1); print("check sync"); -replTest.awaitReplication(60 * 1000); +replTest.awaitReplication(); print("add data"); reconnect(server1); diff --git a/jstests/sharding/auth.js b/jstests/sharding/auth.js index cb5e8ab42f3..61b25f10dde 100644 --- a/jstests/sharding/auth.js +++ b/jstests/sharding/auth.js @@ -243,10 +243,10 @@ d2.waitForState(d2.getSecondaries(), ReplSetTest.State.SECONDARY, 5 * 60 * 1000); authutil.asCluster(d1.nodes, "jstests/libs/key1", function() { - d1.awaitReplication(120000); + d1.awaitReplication(); }); authutil.asCluster(d2.nodes, "jstests/libs/key1", function() { - d2.awaitReplication(120000); + d2.awaitReplication(); }); // add admin on shard itself, hack to prevent localhost auth bypass diff --git a/jstests/sharding/commands_that_write_accept_wc_configRS.js b/jstests/sharding/commands_that_write_accept_wc_configRS.js index 4a983a0b7b7..a864691dee0 100644 --- a/jstests/sharding/commands_that_write_accept_wc_configRS.js +++ b/jstests/sharding/commands_that_write_accept_wc_configRS.js @@ -263,7 +263,7 @@ load('jstests/multiVersion/libs/auth_helpers.js'); setupFunc(); // Stop replication at all config server secondaries and all shard secondaries. stopReplicationOnSecondariesOfAllShards(st); - st.configRS.awaitReplication(30000); + st.configRS.awaitReplication(); stopReplicationOnSecondaries(st.configRS); // Command should fail after two config servers are not replicating. diff --git a/jstests/sharding/shard_aware_on_set_shard_version.js b/jstests/sharding/shard_aware_on_set_shard_version.js index 56eca3c33a5..7c76d1c8f7c 100644 --- a/jstests/sharding/shard_aware_on_set_shard_version.js +++ b/jstests/sharding/shard_aware_on_set_shard_version.js @@ -26,7 +26,7 @@ } }); - st.configRS.awaitReplication(60 * 1000); + st.configRS.awaitReplication(); var configVersion = st.s.getDB('config').getCollection('version').findOne(); assert.neq(null, configVersion); var clusterId = configVersion.clusterId; diff --git a/jstests/sharding/zbigMapReduce.js b/jstests/sharding/zbigMapReduce.js index ac4380267e8..302b0b5f018 100644 --- a/jstests/sharding/zbigMapReduce.js +++ b/jstests/sharding/zbigMapReduce.js @@ -220,7 +220,7 @@ function runTest(s) { // Stop the balancer to prevent new writes from happening and make sure // that replication can keep up even on slow machines. s.stopBalancer(); - s._rs[0].test.awaitReplication(300 * 1000); + s._rs[0].test.awaitReplication(); assert.eq(51200, primary.getDB("test")[outcol].count(), "Wrong count"); for (var i = 0; i < secondaries.length; ++i) { assert.eq(51200, secondaries[i].getDB("test")[outcol].count(), "Wrong count"); |