[SERVER-80098] Sample might return "done" before "limit" number of docs is returned Created: 15/Aug/23  Updated: 29/Oct/23  Resolved: 22/Aug/23

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

Type: Bug Priority: Minor - P4
Reporter: Matthew Normyle Assignee: Aadesh Patel (Inactive)
Resolution: Fixed Votes: 0
Labels: init-337-m3, new-eng
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Atlas Streams
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Sprint 30
Participants:

 Description   

The Sampler code will mark itself as done once it has populated "limit" number of documents:
if (numDocs >= _options.maxDocsToSample || numBytes >= _options.maxBytesToSample) {
done = true;
break;
}
However, this logic does not take into account how many documents have actually be returned to the client. 

This problem can be reproduced with a batch size of 3 and a limit of 5.



 Comments   
Comment by Matthew Normyle [ 15/Aug/23 ]

All credit to sharan.singh@mongodb.com  

Comment by Sandeep Dhoot [ 15/Aug/23 ]

Thanks for finding this issue, Matthew!

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