-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace Endpoints with Regional Endpoints (#39390)
* add new policy, add logic to use policy * added small test file I was using * initial regional endpoint work * groundwork * re-add AzureError logic, refactor, fix tests * Update _retry_utility.py * Updated location_cache with new design * Fixed key error with most_preferred_location * Update test_cosmos_http_logging_policy.py * Update _retry_utility.py * Added logic to refresh cache on previous endpoint usage * Added business logic update the regional endpoint based on success or failures * implementation * Update _retry_utility_async.py * fix some tests * changelog, versions, fixes * fixes * fix some tests * remove fake logic, count fix * fix some tests * Update _service_request_retry_policy.py * Update _retry_utility_async.py * retry utilities fixing * Update _retry_utility.py * additional enhancements * Update setup.py * Update _retry_utility_async.py * add tests, remove previous retry logic for ServiceRequestExceptions * clean up with finally * tests * retry utilities * disable tests * add logging to policies * GetDatabaseAccount Fix * Update _base.py * retry utilities fixes * Update _retry_utility.py * retry utulities part 34 * Update _service_request_retry_policy.py * remove extra logs * policy updates * Update _service_response_retry_policy.py * Update _service_response_retry_policy.py * policies updates and update operation types * trying out fixes * Update sdk/cosmos/azure-cosmos/CHANGELOG.md Co-authored-by: Abhijeet Mohanty <mabhijeet1995@gmail.com> * Update sdk/cosmos/azure-cosmos/CHANGELOG.md Co-authored-by: Abhijeet Mohanty <mabhijeet1995@gmail.com> * Skipped proxy test for debugging * annotation fix * Fixed some tests cases * test fixes * Update test_service_retry_policies_async.py * Fixed some mocking behavior * fixed pylint issues * Added aiohttp minimum dependency * Updated changelog and setup.py * Updated changelog * Add changelog and fix tests. * Fix tests * bootstrapping with global endpoint as previous for writes * Add headers and cleanup * cleanup and retry all service request headers * Don't retry on a none previous * Updated the business logic with current and previous, fixed database account refresh and some retry policies * fix client id * Reacting to comments * Added print statements and fixed some retry logic * Revert getDatabase in mark endpoint * Fixed some pylint and changelog issues * Fixed version * fix bug with type check, update tests * Update test_service_retry_policies_async.py * sync tests updates * Reacting to comments and fixing service request retry policy * Code review comments and pylint issues * Fixed tests and pylint * more sync mock tests - missing async copies * Fixed min aiohttp requirements * Update _retry_utility_async.py * Change to check operation type in operations * push initial GEM mock test * Update test_service_retry_policies.py * Fixed extra retries * sync tests * Update test_service_retry_policies_async.py * Fixed extra retries and relevant tests * Only delay retry by one second * async tests - need to split up inheritance ones since endpoint unavailable stops extra retries * Change retry strategy * add sub-class errors tests * change old tests, refactoring, fix mocking bleed * Fix a test * clear last routed location pythonic * Removed aiohttp dependency * catch import errors * Skipped global endpoint manager test for debugging * Fixed tests * Removed skips * fix live tests and print statements for debugging * cleanup of few tests * updated globaldb mock * Moved some of the high offer throughput tests to live tests * Fixed global endpoint retry async test * Tried fixing global endpoint retry async test * no swaps on success test * fix import * Tried fixing global endpoint retry async test * Added separate split live tests * Added live platform matrix * some test fixes * Fixed live test pipeline * Moved test resource id to cosmosLong * Updated live tests * Running live tests with proper flag * testing logging experiments * fix tests * honor testmark argument through a safe environment variable, versus accessing the value directly * more test fixes * remove accidental log files * Fixed issues with swapping and retry policies * Fixed issues with swapping and retry policies * Marking endpoint as down fix * more test fixes * Remove print statements * Fixed some minor issues with emulator tests * split change feed tests * Fixed emulator tests * updated changelog * Fixed emulator tests again * Fixed emulator tests and event loop * vector/fts query tests * Fix session token live tests * hybrid search query fixes * Fixed live test name * fallback to regional * fix ci tests * Update conftest.py * Database accounts call will timeout in 5 seconds * Change timeouts and update docs * call updates to endpoint policy and location cache * Health check for endpoitns * database account retry policy * Fix parameter error * Retry on cosmos error fix * Retry on service request error fix * None checks for request in retry utilities * lowercase constructed regional endpoint * fix global endpoint as unhealthy * fix parsing test * Added logic for swapping on health check failed * Fixed log statement * fix pylint, docs, and remove print statements * fix pylint * fix some tests * Prepared for release --------- Co-authored-by: Simon Moreno <30335873+simorenoh@users.noreply.github.com> Co-authored-by: Kushagra Thapar <kuthapar@microsoft.com> Co-authored-by: Abhijeet Mohanty <mabhijeet1995@gmail.com> Co-authored-by: Scott Beddall <scbedd@microsoft.com>
- Loading branch information
1 parent
aee42e7
commit fe6b4c7
Showing
77 changed files
with
2,365 additions
and
1,187 deletions.
There are no files selected for viewing
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
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
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
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
49 changes: 49 additions & 0 deletions
49
sdk/cosmos/azure-cosmos/azure/cosmos/_database_account_retry_policy.py
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# The MIT License (MIT) | ||
# Copyright (c) 2014 Microsoft Corporation | ||
|
||
# Permission is hereby granted, free of charge, to any person obtaining a copy | ||
# of this software and associated documentation files (the "Software"), to deal | ||
# in the Software without restriction, including without limitation the rights | ||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
# copies of the Software, and to permit persons to whom the Software is | ||
# furnished to do so, subject to the following conditions: | ||
|
||
# The above copyright notice and this permission notice shall be included in all | ||
# copies or substantial portions of the Software. | ||
|
||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
# SOFTWARE. | ||
|
||
"""Internal class for database account retry policy implementation in the | ||
Azure Cosmos database service. | ||
""" | ||
|
||
class DatabaseAccountRetryPolicy(object): | ||
"""The database account retry policy which should only retry once regardless of errors. | ||
""" | ||
|
||
def __init__(self, connection_policy): | ||
self.retry_count = 0 | ||
self.retry_after_in_milliseconds = 0 | ||
self.max_retry_attempt_count = 1 | ||
self.connection_policy = connection_policy | ||
|
||
def ShouldRetry(self, exception): # pylint: disable=unused-argument | ||
"""Returns true if the request should retry based on the passed-in exception. | ||
:param exceptions.CosmosHttpResponseError exception: | ||
:returns: a boolean stating whether the request should be retried | ||
:rtype: bool | ||
""" | ||
|
||
if self.retry_count >= self.max_retry_attempt_count: | ||
return False | ||
|
||
self.retry_count += 1 | ||
|
||
return True |
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
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
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
Oops, something went wrong.