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

Accept command struct arguments instead of BSONObjs in internal transaction API

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

      The internal transaction API accepts command arguments in a number of different forms. Two methods, runCommand and runCommandChecked, accept their commands as BSONObjs, and they are the basis for the implementation of the other runCommand-overloads. The implementation of these methods checks for the presence of and appends many different transaction-related fields to the request document, and this involves many linear scans of the BSON and reallocations of the document, which is error prone and not performant.

      Instead, we should replace these methods with ones that accept IDL-generated command structs instead, as this will let the implementation inspect/modify these fields without doing expensive lookups. This is possible now that all IDL-generated commands include generic arguments (e.g. txnNumber), which was introduced in SERVER-85791.

      From a quick look, many of the existing usages of the internal transaction API pass in MyIdlStruct.toBSON() to these methods, so replacing them should be fairly straightforward.

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

              Created:
              Updated: