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

Eliminate redundant request copies when serializing a RemoteCommandRequest

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

      RemoteCommandRequest implements an explicit conversion to OpMsgRequest that calls through to OpMsgRequestBuilder::create. create will make a copy of the request BSONObj if it is not the sole owner of it, which will always be the case due to the const-ness of the operator not allowing for moving out of this. As a result, all internal operations make a copy of their request, regardless of whether it is actually necessary.

      We should change the way we convert between RemoteCommandRequest and OpMsgRequest to ensure no unnecessary copies are made, at minimum. We should also explore more generally if we can make better use of IDL-generated command requests serialize method, which serializes directly to an OpMsgRequest. This guarantees no unneeded copies are made, while also supporting the usage of document sequences.

            Assignee:
            Unassigned Unassigned
            Reporter:
            patrick.freed@mongodb.com Patrick Freed
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: