[CDRIVER-3324] Session not pinned to mongos when not relying on server selection Created: 19/Aug/19  Updated: 28/Oct/23  Resolved: 22/Aug/19

Status: Closed
Project: C Driver
Component/s: None
Affects Version/s: 1.15.0
Fix Version/s: 1.15.1

Type: Bug Priority: Major - P3
Reporter: Andreas Braun Assignee: Clyde Bazile III (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
is depended on by PHPC-1290 Support mongos pinning for sharded tr... Closed

 Description   

When providing the _mongoc_client_command_with_opts function with a server_id in opts, mongoc_cluster_stream_for_server is called directly, skipping server selection logic contained in _mongoc_cluster_select_server_id. However, this also bypasses session pinning when using sharded transactions. The pinning should happen regardless of who performs server selection. Fixing this by pinning in mongoc_cluster_stream_for_server instead of during server selection also resolves a similar issue when providing a server_id option to the mongoc_bulk_operation_execute and _mongoc_cursor_fetch_stream functions.

The rationale behind this is that the PHP driver performs server selection itself before issuing commands, as it needs to know which server a command ran on for result cursors and write result objects.



 Comments   
Comment by Githook User [ 23/Aug/19 ]

Author:

{'name': 'Clyde Bazile', 'email': 'bazileclyde@gmail.com', 'username': 'bazile-clyde'}

Message: CDRIVER-3324 Session not pinned when not relying on server selection
Branch: r1.15
https://github.com/mongodb/mongo-c-driver/commit/6f73903ae094694143254b48af469fc59cded0b2

Comment by Githook User [ 22/Aug/19 ]

Author:

{'username': 'bazile-clyde', 'email': 'bazileclyde@gmail.com', 'name': 'Clyde Bazile'}

Message: CDRIVER-3324 Session not pinned when not relying on server selection
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/505883265e3a78b496a5ce71d9411c07df3db28d

Generated at Wed Feb 07 21:17:42 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.