0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-11-24 00:17:37 +01:00
mongodb/jstests/sharding/live_shard_logical_initial_sync.js
Matt Broadstone 771dabd098 SERVER-81339 Convert ReplSetTest and ShardingTest to modules (#26332)
GitOrigin-RevId: 744aa110a53786b23c62ff53f87a1418b5991e8d
2024-08-20 22:00:49 +00:00

33 lines
1.1 KiB
JavaScript

/**
* Tests that sharding state is properly initialized on new shard members that were added into live
* shards using logical initial sync.
*
* We control our own failovers, and we also need the RSM to react reasonably quickly to those.
* @tags: [does_not_support_stepdowns, requires_streamable_rsm]
*/
import {ShardingTest} from "jstests/libs/shardingtest.js";
import {ShardingStateTest} from "jstests/sharding/libs/sharding_state_test.js";
const st = new ShardingTest({config: 1, shards: {rs0: {nodes: 1}}});
const rs = st.rs0;
let newNode;
if (TestData.configShard) {
newNode = ShardingStateTest.addReplSetNode({
replSet: rs,
serverTypeFlag: "configsvr",
newNodeParams: "featureFlagTransitionToCatalogShard=true"
});
} else {
newNode = ShardingStateTest.addReplSetNode({replSet: rs, serverTypeFlag: "shardsvr"});
}
jsTestLog("Checking sharding state before failover.");
ShardingStateTest.checkShardingState(st);
jsTestLog("Checking sharding state after failover.");
ShardingStateTest.failoverToMember(rs, newNode);
ShardingStateTest.checkShardingState(st);
st.stop();