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] Service Request and Response retries #39396

Merged
merged 43 commits into from
Jan 26, 2025

Conversation

simorenoh
Copy link
Member

@simorenoh simorenoh commented Jan 24, 2025

This PR introduces cross-regional retries for requests failing to reach the service, or where the service failed to provide a response.

Changes
In the case of a ServiceRequestError, where we know the request didn't reach the service, we know it is safe to retry. In this case we don't have any filters for the operation, and retry once in each relevant preferred region location before raising the exception to the user.

In the case of a ServiceResponseError, where the service was not able to give a response, we filter on these being only exceptions that have to do with unavailability due to timeouts with the service. If that's the case, then we filter on these requests being exclusively document-level read operations, since these are the only ones we know we can retry safely upon not being able to ascertain the output of the request sent. These are retried in the relevant available preferred read locations.

This PR also contains a bugfix to ensure that even if preferred regions are not present in the current account regions, we don't attempt to go into them.

Testing
Manual testing for the first set of changes has been done by reducing the connection timeout on requests after the client is initialized and fetches the database account information. Added tests mocking this functionality.

Manual testing for the bugfix has been done as well, where we see that even though the most_preferred_endpoint is one that is no longer present in the account, we don't attempt to go into it when resolving the service endpoint.

@simorenoh simorenoh requested review from annatisch and a team as code owners January 24, 2025 22:34
@azure-sdk
Copy link
Collaborator

API change check

APIView has identified API level changes in this PR and created following API reviews.

azure-cosmos

Copy link
Member

@jeet1995 jeet1995 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - thanks!

@kushagraThapar kushagraThapar merged commit db08404 into hotfix/azure-cosmos/4.9.2b2 Jan 26, 2025
19 checks passed
@kushagraThapar kushagraThapar deleted the service-reetries branch January 26, 2025 06:25
@simorenoh simorenoh restored the service-reetries branch January 26, 2025 06:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

6 participants