SERVER-118448 Make sharding_csrs_continuous_config_stepdown use a larger defaultFindReplicaSetHostTimeoutMS and fassertOnLockTimeoutForStepUpDown when running on slow build variants (#47270)

GitOrigin-RevId: 3a3ca0a85aca04660382bdcc541a3dc521b80c22
This commit is contained in:
Cheahuychou Mao 2026-01-30 15:19:48 -05:00 committed by MongoDB Bot
parent bd5225ee2c
commit bb1230c190
3 changed files with 43 additions and 11 deletions

View File

@ -29,6 +29,7 @@ import {Thread} from "jstests/libs/parallelTester.js";
import {ReplSetTest} from "jstests/libs/replsettest.js";
import {ShardingTest} from "jstests/libs/shardingtest.js";
import {reconfig, reconnect} from "jstests/replsets/rslib.js";
import {isSlowBuild} from "jstests/sharding/libs/sharding_util.js";
export class ContinuousStepdown {
/**
@ -335,6 +336,44 @@ function makeShardingTestWithContinuousPrimaryStepdown(stepdownOptions, verbosit
}
}
/**
* Set server parameters to prevent test timeouts due to config stepdowns.
*/
setServerParameters() {
if (isSlowBuild(this.configRS.getPrimary())) {
// Sets a large defaultFindReplicaSetHostTimeoutMS on mongos to avoid timeouts in
// the ReplicaSetMonitor due to config stepdowns.
this._mongos.forEach((mongos) => {
try {
const conn = new Mongo(mongos.host);
assert.commandWorked(
conn.adminCommand({setParameter: 1, defaultFindReplicaSetHostTimeoutMS: 2 * 60 * 1000}),
);
} catch (e) {
if (isNetworkError(e)) {
jsTest.log(
"Got a network error when setting server parameter on mongos: " +
tojson({host: mongos.host, error: e}),
);
// The network error is only expected if the test misconfigured the
// mongoses.
assert(TestData.misconfigureMongoses);
return;
}
throw e;
}
});
// Set a large fassertOnLockTimeoutForStepUpDown on config server nodes to avoid
// fasserts due to slow stepdowns.
this.configRS.nodes.forEach((node) => {
assert.commandWorked(
node.adminCommand({setParameter: 1, fassertOnLockTimeoutForStepUpDown: 3 * 60}),
);
});
}
}
/**
* Calls startContinuousFailover on the config server and/or each shard replica set as
* specifed by the stepdownOptions object.

View File

@ -3,17 +3,7 @@ import "jstests/libs/override_methods/implicitly_retry_on_config_stepdowns.js";
import {kOverrideConstructor as kOverrideConstructorForRST, ReplSetTest} from "jstests/libs/replsettest.js";
import {kOverrideConstructor as kOverrideConstructorForST, ShardingTest} from "jstests/libs/shardingtest.js";
function isSlowBuildFromTestOptions() {
const testOptions = jsTestOptions();
return (
testOptions.isAddressSanitizerActive ||
testOptions.isThreadSanitizerActive ||
testOptions.isDebug ||
_isWindows()
);
}
const stepdownIntervalMS = isSlowBuildFromTestOptions() ? 15 * 1000 : 8 * 1000;
const stepdownIntervalMS = 8 * 1000;
const {ReplSetTestWithContinuousPrimaryStepdown, ShardingTestWithContinuousPrimaryStepdown} =
ContinuousStepdown.configure(
@ -42,6 +32,7 @@ ShardingTest[kOverrideConstructorForST] = class ShardingTestWithContinuousFailov
// Set the feature on the test configuration; this will allow js tests to selectively
// skip/alter test cases.
TestData.runningWithConfigStepdowns = true;
this.setServerParameters();
// Automatically start the continuous stepdown thread on the config server replica set.
this.startContinuousFailover();
}

View File

@ -7,6 +7,8 @@ import {ShardingTest} from "jstests/libs/shardingtest.js";
// Because this test intentionally causes the server to crash, we need to instruct the
// shell to clean up the core dump that is left behind.
TestData.cleanUpCoreDumpsFromExpectedCrash = true;
// This test misconfigures one of the mongoses.
TestData.misconfigureMongoses = true;
const params = {
healthMonitoringIntensities: tojson({