-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
kushagraThapar
merged 43 commits into
hotfix/azure-cosmos/4.9.2b2
from
service-reetries
Jan 26, 2025
Merged
[Cosmos] Service Request and Response retries #39396
kushagraThapar
merged 43 commits into
hotfix/azure-cosmos/4.9.2b2
from
service-reetries
Jan 26, 2025
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jeet1995
reviewed
Jan 24, 2025
jeet1995
reviewed
Jan 24, 2025
jeet1995
reviewed
Jan 24, 2025
jeet1995
reviewed
Jan 24, 2025
API change check APIView has identified API level changes in this PR and created following API reviews. |
jeet1995
reviewed
Jan 24, 2025
sdk/cosmos/azure-cosmos/azure/cosmos/aio/_retry_utility_async.py
Outdated
Show resolved
Hide resolved
jeet1995
reviewed
Jan 24, 2025
sdk/cosmos/azure-cosmos/azure/cosmos/aio/_retry_utility_async.py
Outdated
Show resolved
Hide resolved
tvaron3
reviewed
Jan 24, 2025
jeet1995
reviewed
Jan 25, 2025
jeet1995
reviewed
Jan 25, 2025
Co-authored-by: Abhijeet Mohanty <[email protected]>
Co-authored-by: Abhijeet Mohanty <[email protected]>
…-for-python into service-reetries
jeet1995
approved these changes
Jan 26, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - thanks!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.