diff options
author | Benety Goh <benety@mongodb.com> | 2022-04-26 18:16:56 -0400 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-06-29 09:54:31 +0000 |
commit | a2f796d77b94ab24f27a04751522943bc12d8df8 (patch) | |
tree | dccca0b56a1931811c3fc4101e31e19a92218ed1 | |
parent | 14476629f4af6e786550bf842277282d6cad31eb (diff) | |
download | mongo-a2f796d77b94ab24f27a04751522943bc12d8df8.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.js | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/jstests/noPassthrough/serverstatus_indexbulkbuilder.js b/jstests/noPassthrough/serverstatus_indexbulkbuilder.js index a7b6bdbec3f..98d38c88bd5 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,22 @@ assert.eq(indexBulkBuilderSection.count, 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, 2, ['_id_', 'a_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(); })(); |