[SERVER-77720] $collStats aggregation with storageStats always results in incrementing docUnitsRead Created: 01/Jun/23  Updated: 02/Jun/23  Resolved: 02/Jun/23

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: 7.0.0-rc2
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Matt Broadstone Assignee: Backlog - Storage Execution Team
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Duplicate
Related
is related to SERVER-76391 Remove isReadyInMySnapshot() and isPr... Closed
Assigned Teams:
Storage Execution
Operating System: ALL
Participants:

 Description   

When converting from using the legacy collStats command to the $collStats aggregation stage, end-to-end tests have identified that calling the aggregation stage consistently increases docUnitsRead in v7.0 builds of the server. We can reproduce the issue with the following script:

const node = MongoRunner.runMongod({
  setParameter: { aggregateOperationResourceConsumptionMetrics: true }
});
 
const admin = node.getDB("admin");
const db = node.getDB("foo");
 
// add some data to the collection
assert.commandWorked(db.bar.insert({}));
 
// run test
const first = admin.aggregate([{ $operationMetrics: {} }]).next();
db.bar.aggregate([{ "$collStats": { "storageStats": {} } }]);
const second = admin.aggregate([{ $operationMetrics: {} }]).next();
assert.eq(first.db, second.db);
assert.eq(first.primaryMetrics.docUnitsRead, second.primaryMetrics.docUnitsRead);
 
MongoRunner.stopMongod(node);


Generated at Thu Feb 08 06:36:23 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.