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

Sessions are never pinned for single-threaded load balanced clients

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

      Load Balancers: Connection Pinning talks about session pinning, but this is under a heading for "Connection Pooling" so I'm not sure it considers single-threaded SDAM at all.

      Numerous PHPC tests fail because they expect the session to be pinned (i.e. mongoc_client_session_get_server_id returns a non-zero value). I noticed that calls to _mongoc_client_session_pin are only made if _in_sharded_txn() returns true, and that function does not consider LB topologies at all. Is that intentional?

      I imagine that pinning implicitly takes place on single-threaded load balanced clients because there is only a single connection to the LB. Even if the LB is backed by multiple mongos hosts, the client's singular connection will result in only one being used (unless the connection drops and the LB happens to route to another mongos after reconnection).

      With respect to multi-threaded mode (i.e. client pools), I suppose there also isn't a concern since libmongoc isn't really pooling connections. A transaction would be executed entirely through one client, which will have a single LB connection (again, one mongos).

      Assuming there is no bug at play here (in which case please resolve accordingly), is the correct course of action to just have any pinning-related tests exclude LB topologies?

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

              Created:
              Updated:
              Resolved: