diff options
Diffstat (limited to 'jstests/noPassthrough/group_tmp_file_cleanup.js')
-rw-r--r-- | jstests/noPassthrough/group_tmp_file_cleanup.js | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/jstests/noPassthrough/group_tmp_file_cleanup.js b/jstests/noPassthrough/group_tmp_file_cleanup.js index 42c7b95de88..4482b5d61fe 100644 --- a/jstests/noPassthrough/group_tmp_file_cleanup.js +++ b/jstests/noPassthrough/group_tmp_file_cleanup.js @@ -12,6 +12,7 @@ const memoryLimitBytes = memoryLimitMb * 1024 * 1024; const conn = MongoRunner.runMongod({ setParameter: { internalDocumentSourceGroupMaxMemoryBytes: memoryLimitBytes, + internalQuerySlotBasedExecutionHashAggApproxMemoryUseInBytesBeforeSpill: memoryLimitBytes } }); const testDb = conn.getDB(jsTestName()); @@ -23,8 +24,9 @@ for (let i = 0; i < memoryLimitMb + 1; ++i) assert.commandWorked(testDb.largeColl.insert({x: i, largeStr: largeStr + i})); // Inhibit optimization so that $group runs in the classic engine. -const pipeline = +let pipeline = [{$_internalInhibitOptimization: {}}, {$group: {_id: '$largeStr', minId: {$min: '$_id'}}}]; + // Make sure that the pipeline needs to spill to disk. assert.throwsWithCode(() => testDb.largeColl.aggregate(pipeline, {allowDiskUse: false}), ErrorCodes.QueryExceededMemoryLimitNoDiskUseAllowed); @@ -32,5 +34,13 @@ assert.throwsWithCode(() => testDb.largeColl.aggregate(pipeline, {allowDiskUse: testDb.largeColl.aggregate(pipeline); assert.eq(listFiles(conn.dbpath + "/_tmp").length, 0); +// Run the pipeline without $_internalInhibitOptimization so that $group runs in the sbe engine. +pipeline = [{$group: {_id: '$largeStr', minId: {$min: '$_id'}}}]; + +// Make sure that the pipeline needs to spill to disk. +assert.throwsWithCode(() => testDb.largeColl.aggregate(pipeline, {allowDiskUse: false}), + ErrorCodes.QueryExceededMemoryLimitNoDiskUseAllowed); +testDb.largeColl.aggregate(pipeline); + MongoRunner.stopMongod(conn); -})();
\ No newline at end of file +})(); |