[SERVER-57167] Prevent throwing on session creation due to stepdown before stepdown completes Created: 24/May/21 Updated: 27/Oct/23 Resolved: 19/Aug/21 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Sharding |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Task | Priority: | Major - P3 |
| Reporter: | Haley Connelly | Assignee: | Luis Osta (Inactive) |
| Resolution: | Gone away | Votes: | 0 |
| Labels: | sharding-wfbf-day | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||||||
| Participants: | |||||||||||||||||||||
| Linked BF Score: | 39 | ||||||||||||||||||||
| Description |
|
Issue: Ideally, the command would be retargeted upon retry. Proposal: Instead of bubbling the exception immediately back to the caller, wait for the stepdown to complete before throwing to the top layer. This could be done by catching the initial InterruptedDueToReplStateChange exception thrown, blocking until the RSTL is released in the catch block, then calling checkForInterrupt() and throwing. Thus, by the time the session checkout throws, the stepdown has had time to complete. |
| Comments |
| Comment by Luis Osta (Inactive) [ 19/Aug/21 ] |
|
Fixed by - https://jira.mongodb.org/browse/SERVER-53431 |
| Comment by Matthew Russotto [ 19/Aug/21 ] |
|
Yes I believe |
| Comment by Luis Osta (Inactive) [ 19/Aug/21 ] |
|
matthew.russotto Since https://jira.mongodb.org/browse/SERVER-53431 has been backported does this mean that this fix is no longer necessary? |
| Comment by Matthew Russotto [ 08/Jun/21 ] |
|
Yes, before |
| Comment by Max Hirschhorn [ 08/Jun/21 ] |
matthew.russotto, is the behavior you're describing new with |
| Comment by Matthew Russotto [ 07/Jun/21 ] |
|
Usually we avoid drivers exhausting retries by returning isWritablePrimary: false from the hello command (isMaster: false from isMaster for older versions) for the affected node (even if the primary is in a state where it can technically still accept writes), rather than blocking anything on the stepdown completing. This is done with the _waitingForRSTLAtStepDown variable, here This seems to already occur before blocking session checkout, so I'm not sure why we wouldn't retarget already? |
| Comment by Haley Connelly [ 24/May/21 ] |
|
These changes should be backported at least to v4.2 |