Repository navigation
[Cosmos] Service Request and Response retries - #39396
Merged
Kushagra Thapar (kushagraThapar) merged 43 commits intoJan 26, 2025
Merged
Kushagra Thapar (kushagraThapar) merged 43 commits into
Kushagra Thapar (kushagraThapar) merged 43 commits into
Conversation
Simon Moreno (simorenoh)
requested review from
a team and
Anna Tisch (annatisch)
as code owners
January 24, 2025 22:34
Collaborator
|
API change check APIView has identified API level changes in this PR and created following API reviews. |
Co-authored-by: Abhijeet Mohanty <mabhijeet1995@gmail.com>
Co-authored-by: Abhijeet Mohanty <mabhijeet1995@gmail.com>
β¦-for-python into service-reetries
Abhijeet Mohanty (jeet1995)
approved these changes
Jan 26, 2025
Abhijeet Mohanty (jeet1995)
left a comment
Member
There was a problem hiding this comment.
LGTM - thanks!
Kushagra Thapar (kushagraThapar)
merged commit Jan 26, 2025
db08404
into
hotfix/azure-cosmos/4.9.2b2
This file contains hidden or 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
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.