summaryrefslogtreecommitdiff
path: root/jstests
diff options
context:
space:
mode:
authorBenety Goh <benety@mongodb.com>2022-04-29 11:56:13 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-05-10 10:53:41 +0000
commit62d427c2bba0a24e9205f27faecaf9cf04a1570f (patch)
tree22d232e3680cc5eefea22ee3de66f7b420be53d8 /jstests
parent882b0d9dcf6c73cc6a525d63ceb0709ab415eabe (diff)
downloadmongo-62d427c2bba0a24e9205f27faecaf9cf04a1570f.tar.gz
SERVER-64659 add multiple index spec test case for indexBulkBuilder server status section
(cherry picked from commit e2abe094a39dda8d4b8f623de23423868c7efb8f)
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 d65b21d576c..74a3baa0c27 100644
--- a/jstests/noPassthrough/serverstatus_indexbulkbuilder.js
+++ b/jstests/noPassthrough/serverstatus_indexbulkbuilder.js
@@ -86,5 +86,19 @@ assert.gte(indexBulkBuilderSection.count, 3, tojson(indexBulkBuilderSection));
assert.eq(indexBulkBuilderSection.filesOpenedForExternalSort, 1, tojson(indexBulkBuilderSection));
assert.eq(indexBulkBuilderSection.filesClosedForExternalSort, 1, 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 expected values in the server status should add to the numbers at the end of the resumable
+// index build test case.
+assert.commandWorked(coll.createIndexes([{c: 1}, {d: 1}, {e: 1, a: 1}]));
+IndexBuildTest.assertIndexes(newNodeColl, 6, ['_id_', 'a_1', 'b_1', 'c_1', 'd_1', 'e_1_a_1']);
+indexBulkBuilderSection = testDB.serverStatus().indexBulkBuilder;
+assert.eq(indexBulkBuilderSection.count, 4, tojson(indexBulkBuilderSection));
+assert.eq(indexBulkBuilderSection.resumed, 1, tojson(indexBulkBuilderSection));
+assert.eq(indexBulkBuilderSection.filesOpenedForExternalSort, 2, tojson(indexBulkBuilderSection));
+assert.eq(indexBulkBuilderSection.filesClosedForExternalSort, 2, tojson(indexBulkBuilderSection));
+
replSet.stopSet();
})();