summaryrefslogtreecommitdiff
path: root/jstests/sharding/mongos_precache_routing_info.js
blob: 2b4266a6d63d0bae792e5b50c5c68ced0a8b3b95 (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
//@tags: [requires_fcv_44]

(function() {
'use strict';

// create
var s = new ShardingTest({shards: 2});
var db = s.getDB("test");
var ss = db.serverStatus();

const shardCommand = {
    shardcollection: "test.foo",
    key: {num: 1}
};

// shard
assert.commandWorked(s.s0.adminCommand({enablesharding: "test"}));
assert.commandWorked(s.s0.adminCommand(shardCommand));

// split numSplits times
const numSplits = 2;
var i;
for (i = 0; i < numSplits; i++) {
    var midKey = {num: i};
    assert.commandWorked(s.s0.adminCommand({split: "test.foo", middle: midKey}));
}

// restart mongos
s.restartMongos(0);
db = s.getDB("test");

// check for # refreshes started
ss = db.serverStatus();
assert.eq(1, ss.shardingStatistics.catalogCache.countFullRefreshesStarted);

s.stop();
})();