0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-11-24 00:17:37 +01:00
mongodb/jstests/sharding/migration_coordinator_commit_failover.js
Moustafa Maher 2fd5f78d5a SERVER-95421 make initiateWithHighElectionTimeout the default in ReplSetTest (#28174)
GitOrigin-RevId: df168ee363c3f0e86526270437d3688ac4bb326d
2024-10-22 02:53:25 +00:00

64 lines
2.9 KiB
JavaScript

/**
* Tests that a donor resumes coordinating a migration if it fails over after creating the
* migration coordinator document but before deleting it.
*/
// This test induces failovers on shards.
TestData.skipCheckingUUIDsConsistentAcrossCluster = true;
import {
runMoveChunkMakeDonorStepDownAfterFailpoint
} from "jstests/sharding/migration_coordinator_failover_include.js";
import {ShardingTest} from "jstests/libs/shardingtest.js";
const dbName = "test";
// Try and prevent split vote failed elections after freezing / unfreezing by preventing the
// secondary from being electable.
var st = new ShardingTest({
shards: 2,
rs: {nodes: [{rsConfig: {}}, {rsConfig: {priority: 0}}]},
// By default, our test infrastructure sets the election timeout to a very high value (24
// hours). For this test, we need a shorter election timeout because it relies on nodes running
// an election when they do not detect an active primary. Therefore, we are setting the
// electionTimeoutMillis to its default value.
initiateWithDefaultElectionTimeout: true
});
assert.commandWorked(
st.s.adminCommand({enableSharding: dbName, primaryShard: st.shard0.shardName}));
runMoveChunkMakeDonorStepDownAfterFailpoint(st,
dbName,
"hangBeforeMakingCommitDecisionDurable",
false /* shouldMakeMigrationFailToCommitOnConfig */);
runMoveChunkMakeDonorStepDownAfterFailpoint(st,
dbName,
"hangBeforeSendingCommitDecision",
false /* shouldMakeMigrationFailToCommitOnConfig */);
runMoveChunkMakeDonorStepDownAfterFailpoint(st,
dbName,
"hangBeforeForgettingMigrationAfterCommitDecision",
false /* shouldMakeMigrationFailToCommitOnConfig */);
runMoveChunkMakeDonorStepDownAfterFailpoint(
st,
dbName,
"hangInPersistMigrateCommitDecisionThenSimulateErrorUninterruptible",
false /* shouldMakeMigrationFailToCommitOnConfig */);
runMoveChunkMakeDonorStepDownAfterFailpoint(
st,
dbName,
"hangInDeleteRangeDeletionOnRecipientThenSimulateErrorUninterruptible",
false /* shouldMakeMigrationFailToCommitOnConfig */);
runMoveChunkMakeDonorStepDownAfterFailpoint(
st,
dbName,
"hangInReadyRangeDeletionLocallyThenSimulateErrorUninterruptible",
false /* shouldMakeMigrationFailToCommitOnConfig */);
runMoveChunkMakeDonorStepDownAfterFailpoint(st,
dbName,
"hangInAdvanceTxnNumThenSimulateErrorUninterruptible",
false /* shouldMakeMigrationFailToCommitOnConfig */);
st.stop();