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

Manipulate IDL-generated structs instead of BSONObjs in TransactionRouter

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Service Arch
    • Networking & Obs 2024-07-08

      TransactionRouter keeps track of a given transactions state and is used to update command requests with the appropriate transaction-related metadata (e.g. txnNumber). It currently provides a few helper functions for this, most notably attachTxnFieldsIfNeeded, appendFieldsForStartTransaction, and appendFieldsForContinueTransaction. However, manipulating BSON directly is error prone (it has very few type-safety guarantees, appending duplicate keys can be easy) and difficult to read/maintain, as well as not being performant (mutating often involves scanning the BSON and reallocating).

      Instead, we should update these functions to operate over IDL-generated commands or their GenericArguments structs. This will allow us to write more type safe, performant, and easier-to-maintain code.

            Assignee:
            joseph.prince@mongodb.com Joseph Prince
            Reporter:
            patrick.freed@mongodb.com Patrick Freed
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: