-
Type: Improvement
-
Resolution: Unresolved
-
Priority: Major - P3
-
None
-
Component/s: None
-
None
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.
- depends on
-
CDRIVER-3407 Defer checking if a deployment supports sessions until the session's first operation
- Backlog
-
CXX-1858 Defer checking if a deployment supports sessions until the session's first operation
- Blocked
-
PHPC-1469 Defer checking if a deployment supports sessions until the session's first operation
- Blocked
- is related to
-
DRIVERS-2337 Assume all >=3.6 servers support sessions
- Backlog
-
DRIVERS-2530 Do not perform server selection to determine sessions support
- Implementing