Uploaded image for project: 'C Driver'
  1. C Driver
  2. CDRIVER-2432

Unacknowledged writes should not include transaction ID or lsid for retryable writes

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 1.10.0
    • Affects Version/s: 1.9.0
    • Component/s: libmongoc
    • None
    • Fully Compatible

      Per the Retryable Writes spec, unacknowledged writes should never be retried.

      Also, the Sessions Spec says "a driver MUST NOT send a session ID with unacknowledged writes. This is true for both implicit and explicit sessions."

      While testing PHPC with libmongoc 1.9.0-rc1, I discovered that libmongoc is still including transaction IDs in unacknowledged write commands. This is likely the result of _allow_txn_number() in mongoc-cmd.c failing to return to return false. We should be able to trust that the "writeConcern" field, if any, is already merged into the write command before _allow_txn_number() is called, so fixing this should only require _allow_txn_number() checking for w:0.

      Additionally, this fix should catch the case where mongoc_cmd_parts_append_opts() merged in a "writeConcern" option (from a with_opts() function, or the user explicitly provided "writeConcern" in the original command document (as PHPLIB does through PHPC).

      Finally, the driver MUST NOT include "lsid" (the logical session ID) in unacknowledged writes.

            Assignee:
            xiangyu.yao@mongodb.com Xiangyu Yao (Inactive)
            Reporter:
            jmikola@mongodb.com Jeremy Mikola
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: