summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenety Goh <benety@mongodb.com>2022-04-26 18:16:56 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-05-09 10:21:01 +0000
commite8f633678412d0faee1ce0c00685cfaa6d4001c7 (patch)
tree4ae61a7427c60cf385fd27952730eab5161bceb2
parent2b32a92fcccf28d55e44d73bbdb86b1c7c5b7508 (diff)
downloadmongo-e8f633678412d0faee1ce0c00685cfaa6d4001c7.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.js17
1 files changed, 17 insertions, 0 deletions
diff --git a/jstests/noPassthrough/serverstatus_indexbulkbuilder.js b/jstests/noPassthrough/serverstatus_indexbulkbuilder.js
index 5c7859149b0..d65b21d576c 100644
--- a/jstests/noPassthrough/serverstatus_indexbulkbuilder.js
+++ b/jstests/noPassthrough/serverstatus_indexbulkbuilder.js
@@ -69,5 +69,22 @@ assert.eq(indexBulkBuilderSection.resumed, 1, tojson(indexBulkBuilderSection));
assert.eq(indexBulkBuilderSection.filesOpenedForExternalSort, 1, tojson(indexBulkBuilderSection));
assert.eq(indexBulkBuilderSection.filesClosedForExternalSort, 1, 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, 3, ['_id_', 'a_1', 'b_1']);
+indexBulkBuilderSection = newNodeTestDB.serverStatus().indexBulkBuilder;
+// 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 of one.
+assert.gte(indexBulkBuilderSection.count, 3, tojson(indexBulkBuilderSection));
+assert.eq(indexBulkBuilderSection.filesOpenedForExternalSort, 1, tojson(indexBulkBuilderSection));
+assert.eq(indexBulkBuilderSection.filesClosedForExternalSort, 1, tojson(indexBulkBuilderSection));
+
replSet.stopSet();
})();