[DRIVERS-759] Drivers may defer checking if a deployment supports sessions until the session's first operation Created: 22/Oct/19  Updated: 23/Jan/23

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

Type: Improvement Priority: Major - P3
Reporter: Kaitlin Mahar Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
depends on CDRIVER-3407 Defer checking if a deployment suppor... Backlog
depends on CXX-1858 Defer checking if a deployment suppor... Blocked
depends on PHPC-1469 Defer checking if a deployment suppor... Blocked
Duplicate
Related
is related to DRIVERS-2337 Assume all >=3.6 servers support sess... Backlog
is related to DRIVERS-2530 Do not perform server selection to de... Implementing
Driver Compliance:
Key Status/Resolution FixVersion
CDRIVER-3407 Backlog
CXX-1858 Blocked
PHPC-1469 Blocked
SWIFT-647 Fixed 1.0.0-rc0

 Description   

Previously, the sessions specification required that MongoClient.startSession report an error if the deployment does not support sessions.

The spec has now been amended to permit drivers to defer checking for sessions support and reporting that error until the first time the session is used for an operation.

Reporting this error from startSession is still permitted, so drivers may choose to not change anything.

See changes:

https://github.com/mongodb/specifications/commit/5efe2a1d4c7483920fbb11613652416acfb88ce7

The rationale behind this change:

Determining if a deployment supports sessions requires SDAM to have been started. However, some drivers lazily start SDAM the first time a client is used for an operation. If a user creates a client and then immediately starts a session, then startSession would have to perform I/O in order to check for support. For drivers with asynchronous APIs, this means that startSession would have to be an asynchronous method to comply with the spec. This is not ideal; the API becomes unnecessarily clunky and adds the overhead of a promise every time it is used, even though in the majority of cases startSession will require no I/O.

Allowing the error to be reported later on when the session is used for an operation means that startSession can be implemented in a way that never performs I/O.


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