Clean up mongoS change stream throughput metric counting by centralizing at queueResult() call site

    • Type: Task
    • Resolution: Unresolved
    • Priority: Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Query Execution
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      In src/mongo/s/query/exec/cluster_client_cursor_impl.cpp, results are counted toward the change stream metrics (_docsReturned, _bytesReturned) when they emerge from next(). However, some results are stashed and re-served later. When a result is stashed via queueResult(), it was already counted in next(), so queueResult() currently decrements the counters to avoid double counting, and then the stash-serving path in next() re-increments them. Thus we want to extract the metric counting logic to the call site(s) where queueResult() is invoked, so that a result is counted exactly once when it is actually returned to the client, removing the need to decrement in queueResult() and re-increment when serving from the stash.

            Assignee:
            Unassigned
            Reporter:
            Athena Wang
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: