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 /jstests/libs | |
parent | 8927df651a6f19cec03a9739fafa8889b6b33470 (diff) | |
download | mongo-5d1ace4f94df04670f95eadca17a9275d65625ac.tar.gz |
SERVER-27541 Turn off primary catchup in all continuous stepdown suites
Diffstat (limited to 'jstests/libs')
-rw-r--r-- | jstests/libs/override_methods/continuous_stepdown.js | 36 |
1 files changed, 29 insertions, 7 deletions
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); |