[SERVER-66949] The reported count of documents deleted by a targeted deleteMany lower than what is actually deleted Created: 02/Jun/22  Updated: 30/Jan/24

Status: Open
Project: Core Server
Component/s: None
Affects Version/s: 6.0.0-rc8
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Kaloian Manassiev Assignee: Backlog - Query Execution
Resolution: Unresolved Votes: 0
Labels: query-offsite
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Query Execution
Operating System: ALL
Participants:

 Description   

It is a known behaviour of deleteMany in a sharded cluster that it could be applied more than one time if there are migrations and furthermore that it will delete orphaned documents. Because of this, the reported count of documents actually deleted could be way off from what actually got deleted.

However, I would expect that the error is on the upper side, not the lower.

It looks like the BatchWritesExecutor is somehow resetting the counter after retries, because if I delete ~400,000 documents (as shown by countDocuments), if there are ongoing migrations, the report was only about ~40,000 even though all of them were in fact deleted.

I only tried on 6.0 and the latest master, but I suspect the problem is present in older versions as well.



 Comments   
Comment by Kaloian Manassiev [ 02/Jun/22 ]

Assigning to the Query Execution backlog since they officially own the BatchWriteExecutor now.

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