Uploaded image for project: 'PHP Driver: Extension'
  1. PHP Driver: Extension
  2. PHPC-965

Determine how to include transaction IDs in write commands

    • Type: Icon: Task Task
    • Resolution: Works as Designed
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None

      Quoting some comments from the retryable writes spec document:

      jmikola: In the case of PHPLIB, PHPC and libmongoc, where we have a single code path for executing commands, do you expect libmongoc to introspect write command documents and inject the transaction ID? If not, we'll need libmongoc to provide some way for the PHP driver to get the session ID and incrementing counter so we can incorporate it into our own write commands.

      This is also relevant for aggregate and $out, if this spec requires drivers to toss a transaction ID into any write command and let the server decide how to handle it.

      jesse: Can you please use mongoc_client_write_command_with_opts, mongoc_client_read_write_command_with_opts, or one of the functions related to that in the libmongoc API? Then we can have simple logic in libmongoc: if the function has "write_command" in the name and it's in a session with retryWrites=true, include the transactionid.

      PHPC does not maintain a list of write commands, so conditionally using mongoc_client_write_command_with_opts() may not be feasible. We should investigate whether all commands can be routed through mongoc_client_read_write_command_with_opts().

            Assignee:
            Unassigned Unassigned
            Reporter:
            jmikola@mongodb.com Jeremy Mikola
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: