summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenety Goh <benety@mongodb.com>2022-08-28 20:05:46 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-08-29 00:28:45 +0000
commit26d023b723fceba0214fddcf1cddbbe603295b14 (patch)
tree861b0d7d885633efb1857369536059f4bd67cbe9
parentdef884b5dabc692ceb11e878f4b4ce28335f4804 (diff)
downloadmongo-26d023b723fceba0214fddcf1cddbbe603295b14.tar.gz
SERVER-64659 add multiple index spec test case for indexBulkBuilder server status section
(cherry picked from commit e2abe094a39dda8d4b8f623de23423868c7efb8f)
-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();
})();