-
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
Merge pr 35022 into pr34694 - Add Start Time To CF, Fix Retryable Exception in First Page Bug, and Fix Case Sensitive Headers Bug #35090
Conversation
Adds start time, at the moment has a work around for getting all the documents.
Start time change feed queries always result in the initial fetch results being empty, which is a deviation in behaviour from other change feed options. To accommodate that we check if we have the start time change feed option and check if it is the first fetch request in order to grab the continuation value from etag to get the rest of the results.
Added a new header to remove ambuiguity between 'etag' meant for sync clients and 'Etag' meant for async clients in our code for header strings.
added negative test for start time option of change feed.
…ged prs Response headers are now CIMultDict type (Case insensitive Multi Dictionaries) which fixes any issues regarding casing of header strings. This also has changes to merge changes from PR 35022 without issues.
This code checks if a 429 error has occured in which case we reset has started and try getting the fetch items again
sdk/cosmos/azure-cosmos/azure/cosmos/_execution_context/aio/base_execution_context.py
Show resolved
Hide resolved
sdk/cosmos/azure-cosmos/azure/cosmos/_execution_context/aio/base_execution_context.py
Outdated
Show resolved
Hide resolved
API change check APIView has identified API level changes in this PR and created following API reviews. |
Added code to help debug. This will catch 429 exception when it occurs on first page of query so we can see whats going on.
Moving the has_Started flag to after the fetch function seems to make the behaviour better align with what is expected. Retries are properly done for queries that got 429 in the first page of their query, and 429s are also being properly surfaced when retries runout.
Remove trailing spaces, bad indentation, and unused imports
/azp run python - cosmos - tests |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run python - cosmos - tests |
Azure Pipelines successfully started running 1 pipeline(s). |
This push adds test coverage for the retryable exception bug that this PR fixes. It recreates the scenario of the original bug and verifies that the fix is working. This also changes the start time datetime to always be converted to UTC regardless of timezone or if it is a naive datetime.
/azp run python - cosmos - tests |
Azure Pipelines successfully started running 1 pipeline(s). |
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.
awesome work Bryan, thanks!
Fixed outdated comments to better match new code.
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.
Great work @bambriz, thanks for fixing the other bugs as well. Added some comments, and requesting changes for samples on start time usage in change feed query.
sdk/cosmos/azure-cosmos/azure/cosmos/_execution_context/aio/base_execution_context.py
Outdated
Show resolved
Hide resolved
sdk/cosmos/azure-cosmos/azure/cosmos/_execution_context/base_execution_context.py
Outdated
Show resolved
Hide resolved
Co-authored-by: Kushagra Thapar <kushuthapar@gmail.com>
Co-authored-by: Kushagra Thapar <kushuthapar@gmail.com>
Co-authored-by: Kushagra Thapar <kushuthapar@gmail.com>
Added further optimizations.
/azp run python - cosmos - tests |
Azure Pipelines successfully started running 1 pipeline(s). |
pylint fixes
/azp run python - cosmos - tests |
Azure Pipelines successfully started running 1 pipeline(s). |
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 @bambriz
Please also add the sample for using start from time functionality :)
Add samples for start time change feed
/azp run python - cosmos - tests |
Azure Pipelines successfully started running 1 pipeline(s). |
@@ -342,6 +345,8 @@ def query_items_change_feed( | |||
feed_options["partitionKey"] = self._set_partition_key(partition_key) | |||
if is_start_from_beginning is not None: | |||
feed_options["isStartFromBeginning"] = is_start_from_beginning | |||
if start_time is not None and is_start_from_beginning is False and isinstance(start_time, datetime): |
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.
This check isn't correct - we should not be doing an isinstance
check for start_time
- because this will fail silently if they pass in something else. We should just let it fail if they pass in the wrong type.
Description
Original PR 35022
This removes merge conflicts with PR 34694
PR 35022 had an infinite loop issue with queries. Infinite Loop was removed while keeping the fix to the retryable exception bug in the first page of a query. This PR also adds Start Time option in change feed pulls, and fixes a bug where response headers were being returned and used as Case Sensitive Dictionaries. Response Headers are now Case Insensitive Multi Dictionaries.
A utc datetime is passed into the options when calling a change feed pull. If the datetime is not utc it will be converted to utc.
The following Example creates 10 items at two different times. By using start time you can filter out the items created after the time recorded.
All SDK Contribution checklist:
General Guidelines and Best Practices
Testing Guidelines