SERVER-124295: Make aggregation tests work with replicated fast count (#52006)

GitOrigin-RevId: 7f96e48ea60915afb320dc79a6bb2f77ec062e0e
This commit is contained in:
Damian Wasilewicz 2026-04-22 15:46:08 -04:00 committed by MongoDB Bot
parent a7c99c3df6
commit 8a1081df6c
4 changed files with 13 additions and 5 deletions

View File

@ -17,7 +17,8 @@ for (let i = 0; i < memoryLimitMB + 10; i++) {
}
assert.commandWorked(bulk.execute());
assert.gt(coll.stats().size, memoryLimitMB * 1024 * 1024);
const dataSize = assert.commandWorked(db.runCommand({dataSize: coll.getFullName()})).size;
assert.gt(dataSize, memoryLimitMB * 1024 * 1024);
// Test accumulating all values into one array. On debug builds we will spill to disk for $group and
// so may hit the group error code before we hit ExceededMemoryLimit.

View File

@ -18,7 +18,8 @@ for (let i = 0; i < memoryLimitMB + 10; i++) {
}
assert.commandWorked(bulk.execute());
assert.gt(coll.stats().size, memoryLimitMB * 1024 * 1024);
const dataSize = assert.commandWorked(db.runCommand({dataSize: coll.getFullName()})).size;
assert.gt(dataSize, memoryLimitMB * 1024 * 1024);
// Test accumulating all values into one array. On debug builds we will spill to disk for $group and
// so may hit the group error code before we hit ExceededMemoryLimit.

View File

@ -62,7 +62,8 @@ const bigStr = Array(1024 * 1024 + 1).toString(); // 1MB of ','
for (let i = 0; i < memoryLimitMB + 1; i++)
assert.commandWorked(coll.insert({_id: i, bigStr: i + bigStr, random: Math.random()}));
assert.gt(coll.stats().size, memoryLimitMB * 1024 * 1024);
const dataSize = assert.commandWorked(db.runCommand({dataSize: coll.getFullName()})).size;
assert.gt(dataSize, memoryLimitMB * 1024 * 1024);
function test({pipeline, expectedCodes, canSpillToDisk}) {
// Test that 'allowDiskUse: false' does indeed prevent spilling to disk.

View File

@ -1,5 +1,10 @@
// Test that count within a $collStats stage returns the correct number of documents.
// @tags: [assumes_no_implicit_collection_creation_after_drop]
/** Test that count within a $collStats stage returns the correct number of documents.
* @tags: [
* assumes_no_implicit_collection_creation_after_drop,
* # TODO SERVER-124178: Revisit this test.
* featureFlagReplicatedFastCount_incompatible,
* ]
*/
import {assertErrorCode} from "jstests/aggregation/extras/utils.js";
let testDB = db.getSiblingDB("aggregation_count_db");