Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-66949

The reported count of documents deleted by a targeted deleteMany lower than what is actually deleted

    • Type: Icon: Bug Bug
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 6.0.0-rc8
    • Component/s: None
    • Labels:
    • Query Execution
    • ALL

      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.

            Assignee:
            backlog-query-execution [DO NOT USE] Backlog - Query Execution
            Reporter:
            kaloian.manassiev@mongodb.com Kaloian Manassiev
            Votes:
            0 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated: