Remove implicit coupling between async_transaction_rpc and transaction_router

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Unresolved
    • Priority: Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Networking & Observability
    • None
    • 3
    • TBD
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      async_transaction_rpc.h contains code that builds up a fake BSONObj in memory from the received command reply, only to pass it to txnRouter.processParticipantResponse( here.
      The processParticipantResponse function will only extract the fields from the response that are relevant for the response status and for additional transaction participants. Serializing the full reply to BSON is wasteful here.

      SERVER-105552 changes this code so that it won't serialize the full command reply to BSON, but will directly build the TxnResponseMetadata from the received command reply. This avoids full serialization to BSON.

      However, SERVER-105552 introduces an implicit coupling between async_transaction_rpc.h and the TransactionRouter. It manually builds up TxnReponseMetadata from the relevant command reply fields. If in the future any more fields will be added to TxnResponseMetadata that are relevant for handling additional transaction participants, they will needed to be added to the code in async_transaction_rpc.h as well. This is easy to forget.
      To make this coupling explicit and obvious, we should add a (static) method to the TransactionRouter to build a TxnResponseMetadata object from a command reply's generic reply fields.

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

              Created:
              Updated: