blob: a7b6bdbec3fec07bcb284e78c501fe35af0bfd78 (
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
|
/**
* Tests that serverStatus contains an indexBuilder section. This section reports
* globally-aggregated statistics about index builds and the external sorter.
*
* @tags: [
* requires_persistence,
* requires_replication,
* ]
*/
(function() {
'use strict';
const replSet = new ReplSetTest({
nodes: 1,
nodeOptions: {setParameter: {maxIndexBuildMemoryUsageMegabytes: 50}},
});
replSet.startSet();
replSet.initiate();
let primary = replSet.getPrimary();
let testDB = primary.getDB('test');
let coll = testDB.getCollection('t');
for (let i = 0; i < 10; i++) {
assert.commandWorked(coll.insert({
_id: i,
a: 'a'.repeat(10 * 1024 * 1024),
}));
}
assert.commandWorked(coll.createIndex({a: 1}));
let serverStatus = testDB.serverStatus();
assert(serverStatus.hasOwnProperty('indexBulkBuilder'),
'indexBuildBuilder section missing: ' + tojson(serverStatus));
let indexBulkBuilderSection = serverStatus.indexBulkBuilder;
assert.eq(indexBulkBuilderSection.count, 1, tojson(indexBulkBuilderSection));
assert.eq(indexBulkBuilderSection.filesOpenedForExternalSort, 1, tojson(indexBulkBuilderSection));
assert.eq(indexBulkBuilderSection.filesClosedForExternalSort, 1, tojson(indexBulkBuilderSection));
replSet.stopSet();
})();
|