-
Type: Spec Change
-
Resolution: Done
-
Priority: Unknown
-
None
-
Component/s: Sessions
-
Needed
-
The prose test added in DRIVERS-1030 is flakey:
13. To confirm that implicit sessions only allocate their server session after a successful connection checkout * Create a MongoClient with the following options: ``maxPoolSize=1`` and ``retryWrites=true`` * Attach a command started listener that collects each command's lsid * Initiate the following concurrent operations * insertOne * deleteOne * updateOne * bulkWrite ``[ { updateOne } ]`` * findOneAndDelete * findOneAndUpdate * findOneAndReplace * find * Wait for all operations to complete * Assert that all commands contain the same lsid
The issue is that the session is checked back into the pool after the connection is checked back in. So there's always the risk that this test uses >1 server session. The only way to guarantee this test is to also optimize implicit session deallocation as well. However, that is potentially trickier since we would need to ensure that retryable reads/writes, cursors, and other pinned operations don't deallocate the session too early.
Acceptance Criteria
- Change server session pooling to be required by the specification - Some quick analysis implies this would be an easy and no-op change
- If there's contention on this change file a follow up DRIVERS ticket to address this, and make the limiting of session allocation optional for DRIVERS without a session pool
- Explicitly define that sessions should be acquired at connection checkout and SHOULD NOT (but may in extremely rare circumstances) be released before checkIn
- Explicitly state that sessions MUST be released and reused to meet the goal of reducing session allocation to be within the bounds of [1, numConcurrentOperationCount)
- Update test 13 to account for the variability in implementation details (or split out the following into a further test case)
- Drivers MAY assert that exactly one session is used for all the concurrent operations listed in the test, however this is racey if the session isn't released before checkIn (which SHOULD NOT be attempted)
- Drivers SHOULD assert that after repeated runs they are able to achieve the use of exactly one session, this will statistically prove we've reduced the allocation amount
- Drivers MUST assert that the number of allocated sessions never exceeds the number of concurrent operations executing
- causes
-
DRIVERS-2398 Limit mongos Hosts for Implicit Session Prose Test
- Implementing
- related to
-
DRIVERS-1030 Drivers should check out an implicit session only after checking out a connection
- Closed
- split to
-
JAVA-4531 Clarify intended bounding of implicit session allocation and rework flaky prose test
- Closed
-
CDRIVER-4311 Clarify intended bounding of implicit session allocation and rework flaky prose test
- Closed
-
CSHARP-4097 Clarify intended bounding of implicit session allocation and rework flaky prose test
- Closed
-
CXX-2465 Clarify intended bounding of implicit session allocation and rework flaky prose test
- Closed
-
GODRIVER-2332 Clarify intended bounding of implicit session allocation and rework flaky prose test
- Closed
-
MOTOR-909 Clarify intended bounding of implicit session allocation and rework flaky prose test
- Closed
-
NODE-4082 Clarify intended bounding of implicit session allocation and rework flaky prose test
- Closed
-
PHPLIB-811 Clarify intended bounding of implicit session allocation and rework flaky prose test
- Closed
-
PYTHON-3169 Clarify intended bounding of implicit session allocation and rework flaky prose test
- Closed
-
RUBY-2924 Clarify intended bounding of implicit session allocation and rework flaky prose test
- Closed
-
RUST-1218 Clarify intended bounding of implicit session allocation and rework flaky prose test
- Closed