Make conditions for buffering and consuming full remote responses symmetric

XMLWordPrintableJSON

    • Query Execution
    • Fully Compatible
    • QE 2025-05-12, QE 2025-05-26
    • 200
    • None
    • 3
    • TBD
    • None
    • None
    • None
    • None
    • None
    • None

      The AsyncResultsMerger on mongos currently unconditionally buffers all successfully received shard responses in its _remoteResponses queue.
      The value_type of this queue is a struct that contains the shard id and the entire BSON of the response.
      This queue is drained in various situations, e.g. when pulling a next result from the AsyncResultsMerger or when detaching it from the OperationContext.
      Draining the queue is done in this method, which finally calls into processAdditionalTransactionParticipantFromResponse() for each of the queued remote responses.
      That method looks a bit strange, because it will only process the passed response if the feature flag gFeatureFlagAllowAdditionalParticipants is set. Or in other words, if the feature flag is not set, then we still buffer all the remote responses in the queue, but while draining the queue we don't do anything with these responses, just throwing them away again unused.

      It would be more reasonable to have symmetric conditions for buffering the responses and processing them, so we can avoid unnecessary work if the feature flag is not set.

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

              Created:
              Updated:
              Resolved: