DeleteStage docsFetched can return more documents than in the collection

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Query Integration
    • ALL
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Noticed in SERVER-122077, the DeleteStage docsFetched metric, which is later used by query stats to populate the docsExamined metric, can be larger than the number of documents in the collection. docsFetched in the DeleteStage is aggregated in OpDebug after the delete op entry runs in setPlanSummaryMetrics(). In setPlanSummaryMetrics docsExamined was higher than expected. Those metrics were then aggregated in query stats, leading to unexpected results. This ticket is to investigate why the plan summary metric is higher than the number of documents in the collection, and remove special handling in our query stats tests for this case. 

      See TODOs in code for test examples.

      We did not see this happen with updates, even though both plan stages calculate docsFetched very similarly.  

            Assignee:
            Unassigned
            Reporter:
            Gil Alon
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: