Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fake an InterruptedDueToStepDown error on upstream topology-affecting errors #22

Closed
wants to merge 1 commit into from

Conversation

mdehoog
Copy link
Contributor

@mdehoog mdehoog commented Aug 15, 2020

Fixes #16.

Returns a fake InterruptedDueToStepDown error (code 11602) to the downstream application if the upstream server causes errors that would change the topology. This is to ensure that the application's view of the mongobetween server remains unchanged, and the connection pool isn't drained for no reason.

{
  "ok": 0,
  "code": 11602,
  "codeName": "InterruptedDueToStepDown",
  "errmsg": "interrupted due to shutdown"
}

@mdehoog mdehoog force-pushed the dont-forward-opmsg-error branch 8 times, most recently from b77953b to bb4dc11 Compare August 17, 2020 22:28
@divjotarora
Copy link
Contributor

I've only skimmed the code so far, but I have some thoughts based on the description:

  1. Per this list of error codes, 11602 is InterruptedDueToReplStateChange, not InterruptedDueToStepDown.

  2. 11602 is considered a "node is recovering error" by the the SDAM spec's error handling section. This is more generally considered a state change error, which will force the app servers to mark mongobetween Unknown, which I think we want to avoid. State changes errors clear the server's connection pool if they are shutdown errors or they're from a pre-4.2 server. 11602 is not in the list of shutdown error codes, but mongobetween's isMaster responses have maxWireVersion=7, which is 4.0, so this error will cause the app servers to clear connection pools.

@mdehoog mdehoog closed this Nov 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Drivers could mark mongobetween Unknown for server issues
2 participants