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

Transactions executed on a load balancer do not specify a recoveryToken

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Unknown Unknown
    • 1.25.0, 1.24.5
    • Affects Version/s: None
    • Component/s: Transactions
    • None

      Summary

      By design, libmongoc does not pin sessions for transactions executed against a load balanced topology. This is because clients are pooled instead of connections, and each client only maintains a single socket per server (one for the case of a load balancer).

      Although the rules for pinning in load balancer mode may not apply, rules for the recoveryToken field should apply to both sharded and load balanced topologies. When connected to a load balancer, libmongoc does not appear to ever send a recoveryToken field in outgoing commitTransaction or abortTransaction commands. This was observed when testing the PHP driver with legacy transaction spec tests, which were recently modified to add "load-balanced" to the list of supported topologies for runOn requirements (DRIVERS-2713).

      According to kevin.albertson@mongodb.com, libmongoc's current behavior is:

      • recoveryToken is sent if it was previously stored.
      • Storing recoveryToken requires _in_sharded_txn() be true.
      • being true requires topology type MONGOC_TOPOLOGY_SHARDED (not MONGOC_TOPOLOGY_LOAD_BALANCED)

      This may be indicative of a bug.

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

              Created:
              Updated:
              Resolved: