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

Unify execution path for runCountOnView and runExplainOnView in count_cmd.cpp

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Query Optimization

      The runCountOnView and runExplainOnView are performing the same operation, however they use different logic, this ticket aims to address this mismatch.

      Currently, `runCountOnView` takes as input the opCtx and the request. It creates the AggregateCommandRequest and then serializes the aggregate command into BSON in order to create an opMsgRequest. Then, it calls `runCommandDirectly` which takes as input the opCtx and the opMsgRequest. On the other hand, `runExplainOnView`, takes in the opCtx, the count command request, and the verbosity. It creates the aggregation command request and then calls `runAggregate` to execute.

      We should consider using the same execute function for both `runExplainOnView` and `runCountOnView` so the critical paths are more similar. 'runCommandDirectly' requires serializing the aggregate command into BSON, while runAggregate does not require this serialization. Addressing the mismatch in the underlying execution logic should also address the performance implication of serializing the aggregate command to BSON.

            Assignee:
            Unassigned Unassigned
            Reporter:
            ruchitha.rajaghatta@mongodb.com Ruchitha Rajaghatta
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: