[DRIVERS-2369] Disable causal consistency in implicit sessions Created: 24/Jun/22 Updated: 16/Feb/23 |
|
| Status: | Implementing |
| Project: | Drivers |
| Component/s: | Causal Consistency, Retryability, Sessions |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Matt Dale | Assignee: | Daria Pardue |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Driver Changes: | Needed | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Quarter: | FY23Q3 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Downstream Changes Summary: | Drivers should sync the new unified sessions tests in mongodb/specifications@5a15b65. Drivers that enable `causalConsistency` in implicit sessions by default will require code changes. Note that `causalConsistency` must continue to be enabled by default in explicit sessions. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Driver Compliance: |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Description |
Drivers ChangesDrivers should sync the new unified sessions tests in mongodb/specifications@5a15b65. Drivers that enable `causalConsistency` in implicit sessions by default will require code changes. Note that `causalConsistency` must continue to be enabled by default in explicit sessions. SummaryRead concerns "linearizable" and "available" cannot be used in causally consistent sessions (see documentation here; see server code here). However, the Causal Consistency spec says that causal consistency should be enabled in sessions by default unless snapshot=true. Enabling causal consistency in implicit sessions can cause server errors when a user sets read concern "linearizable" or "available". A specific case where this causes a problem is with retryable reads because they reuse the same session and set an "operation time". As a result, a retried read will send a read concern document that includes afterClusterTime. If a user has also set the read concern to "linearizable" or "available", that retried read will fail with error InvalidOptions(72) with message:
Update the Causal Consistency spec to prevent read operations that use implicit sessions from sending a read concern document with field afterClusterTime when field level is not "majority", "local", or "snapshot". We can accomplish that by either requiring that drivers set causalConsistency=false for all implicit sessions or for implicit sessions where the read concern is not "majority", "local", or "snapshot". Open questions:
Example repro steps
We expect that the "find" operation to be retried once and then successfully return results. What actually happens is the server responds the first time with the failpoint error ShutdownInProgress(91), then when the "find" is retried the server responds with error InvalidOptions(72) with message:
Additional references to causal consistency that may require updatingThe Retryable Reads specification mentions in question Can drivers resend the same wire protocol message on retry attempts?:
If we chose to disable causal consistency in implicit sessions, retried reads will not send readConcern.afterClusterTime. We should update that answer section to describe the updated behavior. MotivationWho is the affected end user?Users who set read concern "linearizable" or "available" and leave retryable reads enabled (enabled by default). How does this affect the end user?Retried read operations will fail with server error InvalidOptions(72) with message:
How likely is it that this problem or use case will occur?If a user sets read concern "linearizable" or "available" and doesn't explicitly disable retryable reads, any retried read will return an error. If the problem does occur, what are the consequences and how severe are they?Retried read operations that may have succeeded will always return an error instead of a result. In affected drivers, retryable reads do not work with read concern "linearizable" or "available". Is this issue urgent?This bug affects at least the Go driver and could affect other drivers as well. The Java driver sets causalConsistency=false for all implicit sessions and is not affected. The bug in the Go driver affects the mongosync project and is moderately urgent. The team maintaining mongosync does have a workaround, which is to use explicit sessions for all operations that need to use read concern "linearizable" or "available" and set causalConsistency=false on the session. Is this ticket required by a downstream team?No. Is this ticket only for tests?No. |
| Comments |
| Comment by Githook User [ 10/Jan/23 ] |
|
Author: {'name': 'Julius Park', 'email': 'Juliusgeo@gmail.com', 'username': 'juliusgeo'}Message: DRIVERS-2369 Disable causal consistency in implicit sessions (#1132) |
| Comment by Githook User [ 15/Nov/22 ] |
|
Author: {'name': 'Daria Pardue', 'email': 'daria.pardue@mongodb.com', 'username': 'dariakp'}Message: DRIVERS-2369 Default causal consistency should be false in implicit sessions (#1345) |
| Comment by Martin Bajana [ 11/Jul/22 ] |
|
shane.harvey@mongodb.com can you assist Daria and review this bug. Thanks. |