[DRIVERS-2530] Do not perform server selection to determine sessions support Created: 23/Jan/23  Updated: 21/Aug/23

Status: Implementing
Project: Drivers
Component/s: Sessions
Fix Version/s: None

Type: Improvement Priority: Unknown
Reporter: Kaitlin Mahar Assignee: Daria Pardue
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
is depended on by DRIVERS-1671 Add log messages to Server selection ... Implementing
Issue split
split to CDRIVER-4566 Do not perform server selection to de... Backlog
split to CXX-2643 Do not perform server selection to de... Backlog
split to RUBY-3212 Do not perform server selection to de... Backlog
split to PHPLIB-1073 Do not perform server selection to de... Blocked
split to JAVA-4860 Do not perform server selection to de... Closed
split to CSHARP-4504 Do not perform server selection to de... Closed
split to GODRIVER-2742 Do not perform server selection to de... Closed
split to MOTOR-1090 Do not perform server selection to de... Closed
split to NODE-5017 Do not perform server selection to de... Closed
split to PYTHON-3587 Do not perform server selection to de... Closed
split to RUST-1585 Do not perform server selection to de... Closed
Related
related to DRIVERS-2337 Assume all >=3.6 servers support sess... Backlog
related to DRIVERS-759 Drivers may defer checking if a deplo... Implementing
is related to DRIVERS-1204 Easier debugging with standardized lo... Implementing
Driver Changes: Needed
Quarter: FY24Q1
Downstream Changes Summary:

Drivers should implement the sessions spec changes in 90cfaef, removing the server selection step for session support and relying exclusively on the `logicalSessionTimeoutMinutes` reported by the checked out connection instead. Two new prose tests are added to ensure the user-facing behavior for explicit and implicit sessions remains unchanged when communicating with a server that does not support sessions. This work is a pre-requisite for sever selection logging (DRIVERS-1671), which will define additional tests to ensure no server selection is performed for session support.

Program Manager: Jessica Sigafoos Jessica Sigafoos
Start date:
Driver Compliance:
Key Status/Resolution FixVersion
CDRIVER-4566 Backlog
CXX-2643 Backlog
CSHARP-4504 Done 2.20.0
GODRIVER-2742 Fixed 1.13.0, 1.13.1
JAVA-4860 Fixed 4.10.0
NODE-5017 Done 5.2.0
MOTOR-1090 Duplicate
PYTHON-3587 Done
PHPLIB-1073 Blocked
RUBY-3212 Backlog
RUST-1585 Fixed 2.5.0
SWIFT-1697 Won't Do

 Description   

Currently, the sessions spec has drivers perform server selection to determine sessions support if the support status is not currently known: https://github.com/mongodb/specifications/blob/master/source/sessions/driver-sessions.rst#how-to-check-whether-a-deployment-supports-sessions

This approach has some known race conditions, as documented in the spec as well (https://github.com/mongodb/specifications/blob/master/source/sessions/driver-sessions.rst#possible-race-conditions-when-checking-whether-a-deployment-supports-sessions).

Drivers should update their logic to defer checking for sessions support after a connection has actually been checked out. The driver should then check that the particular server supports sessions - that is, the connection has non-null logicalSessionTimeoutMinutes.

If the user supplied an explicit session and it turns out at this point sessions are not supported for the server, the driver can then raise an error.
If no user session was supplied (so an implicit session is used) and it turns out at this point sessions are not supported for the server, the driver can ignore the implicit session (the spec already instructs to do this.)

This approach simplifies session support checking and eliminates 3 of the 4 possible race conditions around sessions.

This ticket is being proposed as a subset of the original work imagined in DRIVERS-2337.
This ticket also relates to DRIVERS-759, which changed the spec to permit drivers to defer sessions support checks but would still have sessions support checks performed via server selection.

New Prose Tests

  • Test that an implicit session is not sent to a server that does not support sessions
  • Test that `startSession` does not error but the explicit session raises a client-side error if specified for a server that does not support sessions

Note: Server selection logging work DRIVERS-1671 will define additional tests to confirm that no server selection is performed to determine session support.



 Comments   
Comment by Githook User [ 28/Feb/23 ]

Author:

{'name': 'Daria Pardue', 'email': 'daria.pardue@mongodb.com', 'username': 'dariakp'}

Message: DRIVERS-2530: Defer checking for session support until after connection checkout (#1379)
Branch: master
https://github.com/mongodb/specifications/commit/90cfaeff64cc8d08487ac934d27e1fa267e88814

Generated at Thu Feb 08 08:25:49 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.