diff options
author | Vesselina Ratcheva <vesselina.ratcheva@10gen.com> | 2018-04-18 13:18:34 -0400 |
---|---|---|
committer | Vesselina Ratcheva <vesselina.ratcheva@10gen.com> | 2018-04-30 10:30:53 -0400 |
commit | 5d1ace4f94df04670f95eadca17a9275d65625ac (patch) | |
tree | a96049bbf9634a33e7739f510f52a5e308cf113f | |
parent | 8927df651a6f19cec03a9739fafa8889b6b33470 (diff) | |
download | mongo-5d1ace4f94df04670f95eadca17a9275d65625ac.tar.gz |
SERVER-27541 Turn off primary catchup in all continuous stepdown suites
4 files changed, 37 insertions, 7 deletions
diff --git a/buildscripts/resmokeconfig/suites/jstestfuzz_sharded_continuous_stepdown.yml b/buildscripts/resmokeconfig/suites/jstestfuzz_sharded_continuous_stepdown.yml index 80ca1094c3e..41386886639 100644 --- a/buildscripts/resmokeconfig/suites/jstestfuzz_sharded_continuous_stepdown.yml +++ b/buildscripts/resmokeconfig/suites/jstestfuzz_sharded_continuous_stepdown.yml @@ -51,5 +51,11 @@ executor: configsvr_options: num_nodes: 3 all_nodes_electable: true + replset_config_options: + settings: + catchUpTimeoutMillis: 0 shard_options: all_nodes_electable: true + replset_config_options: + settings: + catchUpTimeoutMillis: 0 diff --git a/buildscripts/resmokeconfig/suites/replica_sets_kill_primary_jscore_passthrough.yml b/buildscripts/resmokeconfig/suites/replica_sets_kill_primary_jscore_passthrough.yml index 75127330c31..1cd7bb7c8af 100644 --- a/buildscripts/resmokeconfig/suites/replica_sets_kill_primary_jscore_passthrough.yml +++ b/buildscripts/resmokeconfig/suites/replica_sets_kill_primary_jscore_passthrough.yml @@ -198,3 +198,4 @@ executor: settings: # Speeds up failover, reduces chance DBClientRS times out retargeting the primary. electionTimeoutMillis: 6500 + catchUpTimeoutMillis: 0 diff --git a/buildscripts/resmokeconfig/suites/retryable_writes_jscore_stepdown_passthrough.yml b/buildscripts/resmokeconfig/suites/retryable_writes_jscore_stepdown_passthrough.yml index dea1317da4a..37332225498 100644 --- a/buildscripts/resmokeconfig/suites/retryable_writes_jscore_stepdown_passthrough.yml +++ b/buildscripts/resmokeconfig/suites/retryable_writes_jscore_stepdown_passthrough.yml @@ -161,3 +161,4 @@ executor: settings: # Speeds up failover, reduces chance DBClientRS times out retargeting the primary. electionTimeoutMillis: 6500 + catchUpTimeoutMillis: 0 diff --git a/jstests/libs/override_methods/continuous_stepdown.js b/jstests/libs/override_methods/continuous_stepdown.js index 93ca12d79eb..356fc64e727 100644 --- a/jstests/libs/override_methods/continuous_stepdown.js +++ b/jstests/libs/override_methods/continuous_stepdown.js @@ -20,6 +20,9 @@ * stepdownIntervalMS: number (default 8 seconds) * Number of milliseconds to wait after issuing a step down command, and discovering the new * primary. + * + * catchUpTimeoutMS: number (default 0 seconds) + * The amount of time allowed for newly-elected primaries to catch up. */ let ContinuousStepdown; @@ -162,7 +165,8 @@ let ContinuousStepdown; electionTimeoutMS: 5 * 1000, shardStepdown: true, stepdownDurationSecs: 10, - stepdownIntervalMS: 8 * 1000 + stepdownIntervalMS: 8 * 1000, + catchUpTimeoutMS: 0, }; stepdownOptions = Object.merge(defaultOptions, stepdownOptions); @@ -214,10 +218,13 @@ let ContinuousStepdown; const _stepdownThread = new StepdownThread(); /** - * Reconfigures the replica set to change its election timeout to - * stepdownOptions.electionTimeoutMS so a new primary can get elected before the - * stepdownOptions.stepdownIntervalMS period would cause one to step down again, then - * starts the primary stepdown thread. + * Reconfigures the replica set, then starts the stepdown thread. As part of the new + * config, this sets: + * - electionTimeoutMillis to stepdownOptions.electionTimeoutMS so a new primary can + * get elected before the stepdownOptions.stepdownIntervalMS period would cause one + * to step down again. + * - catchUpTimeoutMillis to stepdownOptions.catchUpTimeoutMS. Lower values increase + * the likelihood and volume of rollbacks. */ this.startContinuousFailover = function() { if (_stepdownThread.hasStarted()) { @@ -225,14 +232,29 @@ let ContinuousStepdown; } const rsconfig = this.getReplSetConfigFromNode(); - if (rsconfig.settings.electionTimeoutMillis !== stepdownOptions.electionTimeoutMS) { + + const shouldUpdateElectionTimeout = + (rsconfig.settings.electionTimeoutMillis !== stepdownOptions.electionTimeoutMS); + const shouldUpdateCatchUpTimeout = + (rsconfig.settings.catchUpTimeoutMillis !== stepdownOptions.catchUpTimeoutMS); + + if (shouldUpdateElectionTimeout || shouldUpdateCatchUpTimeout) { rsconfig.settings.electionTimeoutMillis = stepdownOptions.electionTimeoutMS; + rsconfig.settings.catchUpTimeoutMillis = stepdownOptions.catchUpTimeoutMS; + rsconfig.version += 1; reconfig(this, rsconfig); - assert.eq(this.getReplSetConfigFromNode().settings.electionTimeoutMillis, + + const newSettings = this.getReplSetConfigFromNode().settings; + + assert.eq(newSettings.electionTimeoutMillis, stepdownOptions.electionTimeoutMS, "Failed to set the electionTimeoutMillis to " + stepdownOptions.electionTimeoutMS + " milliseconds."); + assert.eq(newSettings.catchUpTimeoutMillis, + stepdownOptions.catchUpTimeoutMS, + "Failed to set the catchUpTimeoutMillis to " + + stepdownOptions.catchUpTimeoutMS + " milliseconds."); } _stepdownThread.start(this.nodes[0].host, stepdownOptions); |