blob: 7e6ad5a59fc0f1a684ee800cd610987b87280511 (
plain)
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
|
// Requires no shards.
// @tags: [config_shard_incompatible]
(function() {
'use strict';
var st = new ShardingTest({shards: 2});
var config = st.s.getDB('config');
var admin = st.s.getDB('admin');
jsTest.log('Cannot movePrimary on the config database');
{
// At first, there should not be an entry for config
assert.eq(0, config.databases.count({"_id": "config"}));
// Test that we can enable sharding on the config db
assert.commandWorked(admin.runCommand({enableSharding: 'config'}));
// We should never have a metadata doc for config, it is generated in-mem
assert.eq(0, config.databases.count({"_id": "config"}));
// Test that you cannot set the primary shard for config (not even to 'config')
assert.commandFailed(admin.runCommand({movePrimary: 'config', to: st.shard0.shardName}));
assert.commandFailed(admin.runCommand({movePrimary: 'config', to: 'config'}));
}
jsTest.log('Only system.sessions may be sharded');
{
assert.commandWorked(
admin.runCommand({shardCollection: "config.system.sessions", key: {_id: 1}}));
assert.eq(0, st.s.getDB('config').chunks.count({"shard": "config"}));
assert.commandFailed(admin.runCommand({shardCollection: "config.anythingelse", key: {_id: 1}}));
}
st.stop();
{
var st = new ShardingTest({shards: 0});
var admin = st.s.getDB('admin');
assert.commandFailed(
admin.runCommand({shardCollection: "config.system.sessions", key: {_id: 1}}));
st.stop();
}
})();
|