Refactor injecting query settings for sharded aggregate commands

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

      SERVER-128432 adds support for setting query settings in sharded cluster change streams.

      An outdated version of SERVER-128432 attempted to inject query settings into the aggregate command that is sent to shards in the function createUpdatedCommandForNewShard inside src/mongo/db/pipeline/change_stream_topology_helpers.cpp.

      While this worked, it seems that it was not necessary to add the query settings there.

      The query settings are actually already added elsewhere, precisely in dispatchTargetedPipeineAndAddMergeCursors().
      Query settings are also added inĀ serializeToPassthrough().

      Overall it is not easy to see if and where query settings are added to commands that mongos dispatches to the shard mongods. It seems there is potential to make this easier to understand and clean this up. This will need some investigation of the status quo first.

      Ideally we could also add invariants/tasserts that guard against setting query settings multiple times for the same aggregate command, so that it is not possible for multiple places to set them.

            Assignee:
            Unassigned
            Reporter:
            Jan Steemann
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: