[SERVER-30675] Add configuration options to JavaScript stepdown thread Created: 16/Aug/17  Updated: 30/Oct/23  Resolved: 30/Aug/17

Status: Closed
Project: Core Server
Component/s: Testing Infrastructure
Affects Version/s: None
Fix Version/s: 3.5.13

Type: Improvement Priority: Major - P3
Reporter: Max Hirschhorn Assignee: Jack Mulrow
Resolution: Fixed Votes: 0
Labels: sharding36-passthrough-testing
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
is depended on by SERVER-30676 Add support for stepdown options to t... Closed
Backwards Compatibility: Fully Compatible
Sprint: Sharding 2017-09-11
Participants:

 Description   

The intention is for the majority of the logic of jstests/libs/override_methods/sharding_continuous_config_stepdown.js to be moved to a new continuous_stepdown.js file. The continuous_stepdown.js file should define a ContinuousStepdown global variable with a configure() function that takes the following options:

configStepdown: boolean (default true)
electionTimeoutMS: number (default 5 seconds)
shardStepdown: boolean (default true)
stepdownDurationSecs: number (default 10 seconds)
stepdownIntervalMS: number (default 8 seconds)

The ContinuousStepdown.configure(options) function should cause two new methods startContinuousFailover() and stopContinuousFailover() to be defined on ReplSetTest. The ReplSetTest#startContinuousFailover() function should run the "replSetReconfig" command to change the election timeout to options.electionTimeoutMS in order to support having a new primary get elected before the options.stepdownIntervalMS period would cause one to step down again. The ReplSetTest#startContinuousFailover() function should then start the stepdown thread.

Note: It would likely be cleaner to do a bit of refactoring to the sharding_continuous_config_stepdown.js override and have an actual StepdownThread object (with its own start() and stop() methods) that manages the ScopedThread instance rather than doing it through ReplSetTest#startContinuousFailover() and ReplSetTest#stopContinuousFailover() directly.

The stepdown thread should loop continuously until signaled to stop via a CountDownLatch instance. During each iteration of the loop, the stepdown thread should run the {replSetStepDown: options.stepdownDurationSecs, force: true} command and then call sleep(options.stepdownIntervalMS).

Unlike the existing sharding_continuous_config_stepdown.js override, the ContinuousStepdown.configure(options) function should also cause two new methods startContinuousFailover() and stopContinuousFailover() to be defined on ShardingTest. The ShardingTest#startContinuousFailover() function should call ReplSetTest#startContinuousFailover() for the configRS property of ShardingTest when options.configStepdown is true, and should call ReplSetTest#startContinuousFailover() for each replica-set shard among the _rs property of ShardingTest when options.shardStepdown is true.

The existing contents of sharding_continuous_config_stepdown.js are equivalent to

(function() {
    "use strict";
 
    load("jstests/libs/override_methods/continuous_stepdown.js");
 
    ContinuousStepdown.configure({
        configStepdown: true,
        electionTimeoutMS: 5 * 1000,
        shardStepdown: false,
        stepdownDurationSecs: 10,
        stepdownIntervalMS: 8 * 1000,
    });
 
    const originalShardingTest = ShardingTest;
    ShardingTest = function() {
        originalShardingTest.apply(this, arguments);
 
        // Automatically start the continuous stepdown thread on the config server replica set.
        this.startContinuousFailover();
    };
})();

and should be replaced with something along the aforementioned lines to preserve the behavior of the sharding_continuous_config_stepdown.yml test suite.



 Comments   
Comment by Githook User [ 30/Aug/17 ]

Author:

{'name': 'Jack Mulrow', 'username': 'jsmulrow', 'email': 'jack.mulrow@mongodb.com'}

Message: SERVER-30675 SERVER-30678 Add configuration options to JavaScript stepdown thread
Branch: master
https://github.com/mongodb/mongo/commit/4582f2e1c51f5277488c15732374560ee8ade96f

Generated at Thu Feb 08 04:24:38 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.