[SERVER-82382] Batch/Bulk write size estimation logic on mongos doesn't account for sampleId fields Created: 23/Oct/23  Updated: 20/Nov/23

Status: Needs Scheduling
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Lingzhi Deng Assignee: Backlog - Cluster Scalability
Resolution: Unresolved Votes: 0
Labels: neweng, sharding-nyc-subteam2
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to SERVER-77871 Support shard key metrics sampling Closed
Assigned Teams:
Cluster Scalability
Operating System: ALL
Participants:
Story Points: 3

 Description   

I think the size estimate is calculated here. And that eventually calls BatchItemRef::getSizeForBatchWriteBytes and write_ops::getUpdateSizeEstimate. But the writeOp we use for size calculation is the writeOp from the user request, which shouldn't have the sampleId field. In our implementation, we only attach the sampleId field after we target an operation and before we send to a shard/mongod. So that means that when getUpdateSizeEstimate is called, this would always return boost::none.

This ticket should fix both batchWrite and bulkWrite.


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