Skip to content

cosmos: Enable endToEndTimeout for queryDocumentChangeFeed operation#48144

Open
mbhaskar wants to merge 1 commit intoAzure:mainfrom
mbhaskar:e2etimeout-on-changefeed
Open

cosmos: Enable endToEndTimeout for queryDocumentChangeFeed operation#48144
mbhaskar wants to merge 1 commit intoAzure:mainfrom
mbhaskar:e2etimeout-on-changefeed

Conversation

@mbhaskar
Copy link
Member

Description

Fixes #40507

endToEndTimeout is supported for read and query operations via CosmosEndToEndOperationLatencyPolicyConfig, but the queryDocumentChangeFeed operation previously ignored this configuration entirely.

Changes

  • CosmosChangeFeedRequestOptionsImpl: Added endToEndOperationLatencyPolicyConfig field and implemented the previously stubbed getCosmosEndToEndLatencyPolicyConfig() getter. Added corresponding setter.
  • CosmosChangeFeedRequestOptions (public API): Added setCosmosEndToEndOperationLatencyPolicyConfig() method, mirroring the same API on CosmosQueryRequestOptions.
  • RxDocumentClientImpl: Added getChangeFeedResponseFluxWithTimeout() helper and wired it into queryDocumentChangeFeed() - extracting the e2e policy config from request options and wrapping the change feed flux with timeout when enabled.
  • EndToEndTimeOutValidationTests: Added queryChangeFeedWithEndToEndTimeoutPolicyInOptionsShouldTimeout() test using READ_FEED_ITEM fault injection, verifying OperationCancelledException with CLIENT_OPERATION_TIMEOUT substatus is thrown.

- 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>
Copilot AI review requested due to automatic review settings February 26, 2026 20:25
@mbhaskar mbhaskar requested review from a team and kirankumarkolli as code owners February 26, 2026 20:25
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 endToEndOperationLatencyPolicyConfig field 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 OperationCancelledException with CLIENT_OPERATION_TIMEOUT substatus

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE REQ]Enable e2e timeout for changeFeed query

2 participants