cosmos: Enable endToEndTimeout for queryDocumentChangeFeed operation#48144
Open
mbhaskar wants to merge 1 commit intoAzure:mainfrom
Open
cosmos: Enable endToEndTimeout for queryDocumentChangeFeed operation#48144mbhaskar wants to merge 1 commit intoAzure:mainfrom
mbhaskar wants to merge 1 commit intoAzure:mainfrom
Conversation
- Add endToEndOperationLatencyPolicyConfig field to CosmosChangeFeedRequestOptionsImpl and implement the previously stubbed getCosmosEndToEndLatencyPolicyConfig() method - Add public setCosmosEndToEndOperationLatencyPolicyConfig() API to CosmosChangeFeedRequestOptions mirroring CosmosQueryRequestOptions - Add getChangeFeedResponseFluxWithTimeout() helper in RxDocumentClientImpl for wrapping change feed flux with e2e timeout logic - Apply e2e timeout in queryDocumentChangeFeed() by extracting the config from request options and wrapping the flux when enabled - Add queryChangeFeedWithEndToEndTimeoutPolicyInOptionsShouldTimeout test to EndToEndTimeOutValidationTests using READ_FEED_ITEM fault injection Fixes Azure#40507 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR enables end-to-end timeout support for change feed query operations by implementing the previously stubbed getCosmosEndToEndLatencyPolicyConfig() method in CosmosChangeFeedRequestOptionsImpl and wiring the timeout logic into the queryDocumentChangeFeed() method in RxDocumentClientImpl.
Changes:
- Added
endToEndOperationLatencyPolicyConfigfield and public setter to enable end-to-end timeout configuration on change feed requests - Implemented timeout wrapping for change feed response flux using a new helper method that mirrors the pattern used for query operations
- Added test coverage for timeout behavior using fault injection to verify
OperationCancelledExceptionwithCLIENT_OPERATION_TIMEOUTsubstatus
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
CosmosChangeFeedRequestOptions.java |
Added public API method setCosmosEndToEndOperationLatencyPolicyConfig() to allow configuring end-to-end timeout policy on a per-request basis |
CosmosChangeFeedRequestOptionsImpl.java |
Added private field, getter, setter, and copy constructor support for endToEndOperationLatencyPolicyConfig |
RxDocumentClientImpl.java |
Added getChangeFeedResponseFluxWithTimeout() helper method and integrated it into queryDocumentChangeFeed() to apply timeout wrapping when enabled |
EndToEndTimeOutValidationTests.java |
Added queryChangeFeedWithEndToEndTimeoutPolicyInOptionsShouldTimeout() test using READ_FEED_ITEM fault injection to verify timeout behavior |
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.
Description
Fixes #40507
endToEndTimeoutis supported for read and query operations viaCosmosEndToEndOperationLatencyPolicyConfig, but thequeryDocumentChangeFeedoperation previously ignored this configuration entirely.Changes
CosmosChangeFeedRequestOptionsImpl: AddedendToEndOperationLatencyPolicyConfigfield and implemented the previously stubbedgetCosmosEndToEndLatencyPolicyConfig()getter. Added corresponding setter.CosmosChangeFeedRequestOptions(public API): AddedsetCosmosEndToEndOperationLatencyPolicyConfig()method, mirroring the same API onCosmosQueryRequestOptions.RxDocumentClientImpl: AddedgetChangeFeedResponseFluxWithTimeout()helper and wired it intoqueryDocumentChangeFeed()- extracting the e2e policy config from request options and wrapping the change feed flux with timeout when enabled.EndToEndTimeOutValidationTests: AddedqueryChangeFeedWithEndToEndTimeoutPolicyInOptionsShouldTimeout()test usingREAD_FEED_ITEMfault injection, verifyingOperationCancelledExceptionwithCLIENT_OPERATION_TIMEOUTsubstatus is thrown.