summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenety Goh <benety@mongodb.com>2022-08-28 08:32:16 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-08-28 12:57:08 +0000
commitdef884b5dabc692ceb11e878f4b4ce28335f4804 (patch)
tree667ce7949cea832fbdf493f349cdabf66b74e12e
parent8feeb48360ee87f396068ffe00cc1a5d7282e2e0 (diff)
downloadmongo-def884b5dabc692ceb11e878f4b4ce28335f4804.tar.gz
SERVER-64659 add initial sync test case for indexBulkBuilder server status section
(cherry picked from commit 4adfa1a54c9cba165525caf4a4200a891945637c)
-rw-r--r--jstests/noPassthrough/serverstatus_indexbulkbuilder.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/jstests/noPassthrough/serverstatus_indexbulkbuilder.js b/jstests/noPassthrough/serverstatus_indexbulkbuilder.js
index d42ae64db58..a2d41ab4f2f 100644
--- a/jstests/noPassthrough/serverstatus_indexbulkbuilder.js
+++ b/jstests/noPassthrough/serverstatus_indexbulkbuilder.js
@@ -10,6 +10,8 @@
(function() {
'use strict';
+load('jstests/noPassthrough/libs/index_build.js');
+
const replSet = new ReplSetTest({
nodes: 1,
nodeOptions: {setParameter: {maxIndexBuildMemoryUsageMegabytes: 50}},
@@ -39,5 +41,27 @@ assert.eq(indexBulkBuilderSection.count, 1, tojson(indexBulkBuilderSection));
assert.eq(indexBulkBuilderSection.filesOpenedForExternalSort, 4, tojson(indexBulkBuilderSection));
assert.eq(indexBulkBuilderSection.filesClosedForExternalSort, 4, tojson(indexBulkBuilderSection));
+// Confirm that metrics are updated during initial sync.
+const newNode = replSet.add({setParameter: {maxIndexBuildMemoryUsageMegabytes: 50}});
+replSet.reInitiate();
+replSet.waitForState(newNode, ReplSetTest.State.SECONDARY);
+replSet.awaitReplication();
+let newNodeTestDB = newNode.getDB(testDB.getName());
+let newNodeColl = newNodeTestDB.getCollection(coll.getName());
+IndexBuildTest.assertIndexes(newNodeColl, 2, ['_id_', 'a_1']);
+indexBulkBuilderSection = newNodeTestDB.serverStatus().indexBulkBuilder;
+jsTestLog('initial sync server status: ' + tojson(indexBulkBuilderSection));
+// We expect initial sync to build at least three indexes for the test collection in addition
+// to indexes for internal collections required for the proper running of the server.
+// The test collection has the only index that will cause the external sorter to spill to disk,
+// so the file descriptor open/closed counters should each report a value comparable to that for
+// a single index build that spills to disk.
+// Also, 4.2 does not contain the external sorter improvements in SERVER-54761, so the numbers
+// reported in the server status for file handle activity will be a little different from those
+// for similar index builds in 4.4.
+assert.gte(indexBulkBuilderSection.count, 1, tojson(indexBulkBuilderSection));
+assert.gte(indexBulkBuilderSection.filesOpenedForExternalSort, 4, tojson(indexBulkBuilderSection));
+assert.gte(indexBulkBuilderSection.filesClosedForExternalSort, 4, tojson(indexBulkBuilderSection));
+
replSet.stopSet();
})();