summaryrefslogtreecommitdiff
path: root/jstests
diff options
context:
space:
mode:
Diffstat (limited to 'jstests')
-rw-r--r--jstests/noPassthrough/serverstatus_indexbulkbuilder.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/jstests/noPassthrough/serverstatus_indexbulkbuilder.js b/jstests/noPassthrough/serverstatus_indexbulkbuilder.js
index a2d41ab4f2f..52ad70f04c5 100644
--- a/jstests/noPassthrough/serverstatus_indexbulkbuilder.js
+++ b/jstests/noPassthrough/serverstatus_indexbulkbuilder.js
@@ -63,5 +63,19 @@ assert.gte(indexBulkBuilderSection.count, 1, tojson(indexBulkBuilderSection));
assert.gte(indexBulkBuilderSection.filesOpenedForExternalSort, 4, tojson(indexBulkBuilderSection));
assert.gte(indexBulkBuilderSection.filesClosedForExternalSort, 4, tojson(indexBulkBuilderSection));
+// Building multiple indexes in a single createIndex command increases count by the number of
+// indexes requested.
+// The compound index is the only index that will cause the sorter to use the disk because it
+// indexes large values in the field 'a'.
+// The numbers here will be different from those reported for 4.4 because 4.4 contains the external
+// sorter improvements in SERVER-54761.
+assert.commandWorked(coll.createIndexes([{c: 1}, {d: 1}, {e: 1, a: 1}]));
+IndexBuildTest.assertIndexes(newNodeColl, 5, ['_id_', 'a_1', 'c_1', 'd_1', 'e_1_a_1']);
+indexBulkBuilderSection = testDB.serverStatus().indexBulkBuilder;
+jsTestLog('server status after building multiple indexes: ' + tojson(indexBulkBuilderSection));
+assert.eq(indexBulkBuilderSection.count, 4, tojson(indexBulkBuilderSection));
+assert.gte(indexBulkBuilderSection.filesOpenedForExternalSort, 8, tojson(indexBulkBuilderSection));
+assert.gte(indexBulkBuilderSection.filesClosedForExternalSort, 8, tojson(indexBulkBuilderSection));
+
replSet.stopSet();
})();