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

[Cosmos] Fix retry handling for Session Not Found errors #17032

Closed
wants to merge 2 commits into from

Conversation

southpolesteve
Copy link
Contributor

@southpolesteve southpolesteve commented Aug 23, 2021

In high throughput scenarios with multiple regions, replication lag can sometimes cause a session to not be available. A client will write a document to Region A, and later attempt to read it from Region B. But the session token from region A has not yet been replicated to Region B. This results in Error 404, substatus 1002: Session Not Found.

In these cases the SDK is supposed to retry the request on other regions and if still unsuccessful retry the request again with no session token establishing a new session token. This code was not working correctly. This PR fixes the logic and and adds a test that simulates an out of date session token in a single region scenario.

  1. Add session token test simulating 404/1002 condition
  2. Properly increment retryCount
  3. Instantiate retryCount to 0. Previously it was undefined. var++ for undefined == NaN
  4. Remove session token header when request is being retried

@ghost ghost added the Cosmos label Aug 23, 2021
@southpolesteve southpolesteve changed the title Fix retry handling for Session Not Found errors [Cosmos] Fix retry handling for Session Not Found errors Aug 23, 2021
@southpolesteve
Copy link
Contributor Author

Closed in favor of #17034

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants