1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
/**
* Tests the resharding feature cannot be used when the feature flag is off.
*
* @tags: [
* ]
*/
(function() {
"use strict";
load("jstests/sharding/libs/create_sharded_collection_util.js");
const st = new ShardingTest({
mongos: 1,
mongosOptions: {setParameter: {featureFlagResharding: false}},
config: 1,
configOptions: {setParameter: {featureFlagResharding: false}},
shards: 1,
rs: {nodes: 1},
rsOptions: {setParameter: {featureFlagResharding: false}},
});
const sourceCollection = st.s.getCollection("reshardingDb.coll");
CreateShardedCollectionUtil.shardCollectionWithChunks(
sourceCollection, {x: 1}, [{min: {x: MinKey}, max: {x: MaxKey}, shard: st.shard0.shardName}]);
assert.commandFailedWithCode(
st.s.adminCommand({reshardCollection: sourceCollection.getFullName(), key: {y: 1}}),
ErrorCodes.CommandNotFound);
assert.commandFailedWithCode(
st.s.adminCommand({abortReshardCollection: sourceCollection.getFullName()}),
ErrorCodes.CommandNotFound);
const configPrimary = st.configRS.getPrimary();
assert.commandFailedWithCode(configPrimary.adminCommand({
_configsvrReshardCollection: sourceCollection.getFullName(),
key: {y: 1},
writeConcern: {w: 'majority'}
}),
ErrorCodes.CommandNotSupported);
assert.commandFailedWithCode(
configPrimary.adminCommand({_configsvrAbortReshardCollection: sourceCollection.getFullName()}),
ErrorCodes.CommandNotSupported);
const serverStatusCmd = ({serverStatus: 1, shardingStatistics: 1});
let res = assert.commandWorked(configPrimary.adminCommand(serverStatusCmd));
assert(!res.shardingStatistics.hasOwnProperty("resharding"), res.shardingStatistics);
const shardPrimary = st.shard0.rs.getPrimary();
res = assert.commandWorked(shardPrimary.adminCommand(serverStatusCmd));
assert(!res.shardingStatistics.hasOwnProperty("resharding"), res.shardingStatistics);
st.stop();
})();
|