Normalize attempt to upgrade consistency level to silently ignore them#49606
Open
FabianMeiswinkel wants to merge 8 commits into
Open
Normalize attempt to upgrade consistency level to silently ignore them#49606FabianMeiswinkel wants to merge 8 commits into
FabianMeiswinkel wants to merge 8 commits into
Conversation
Member
Author
|
/azp run java - cosmos - tests |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates Cosmos Java client request header handling so that attempts to upgrade consistency (requesting a stricter consistency than the account default) are silently ignored instead of being sent to gateways that may reject the request. It also wires a new live test profile and adds an integration test suite intended to validate the behavior.
Changes:
- Add a shared
Utils.isConsistencyLevelUpgradehelper and use it to suppress/strip unsupportedx-ms-consistency-levelupgrades. - Centralize consistency header application/removal in
RxDocumentClientImpland apply similar filtering in query header creation and client effective-consistency resolution. - Add a new
-Pconsistency-overrideslive test profile (pipeline matrices, Maven profile, TestNG suite, and a new validation test).
Show a summary per file
| File | Description |
|---|---|
| sdk/cosmos/live-thinclient-platform-matrix.json | Adds -Pconsistency-overrides to thin client live matrix selection/display names. |
| sdk/cosmos/live-platform-matrix.json | Adds -Pconsistency-overrides to the main live test matrix selection/display names. |
| sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/Utils.java | Introduces isConsistencyLevelUpgrade and a consistency “rank” helper. |
| sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/RxDocumentClientImpl.java | Applies consistency header only when applicable and removes unsupported upgrade headers before sending. |
| sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/DocumentQueryExecutionContextBase.java | Avoids sending a client-level consistency override when it would be an upgrade vs account default. |
| sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/CosmosAsyncClient.java | Ignores operation/client desired consistency settings that would upgrade beyond account default. |
| sdk/cosmos/azure-cosmos-tests/src/test/resources/consistency-overrides-testng.xml | Adds a dedicated TestNG suite for the new consistency override validation group. |
| sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/TestSuiteBase.java | Registers the new consistency-overrides group in suite setup/teardown. |
| sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/CosmosConsistencyOverrideValidationTest.java | Adds integration validation for request-level consistency upgrades being ignored (and read-consistency-strategy behavior). |
| sdk/cosmos/azure-cosmos-tests/pom.xml | Adds the consistency-overrides Maven profile to run the new TestNG suite/group. |
Copilot's findings
- Files reviewed: 11/11 changed files
- Comments generated: 1
Member
Author
|
/azp run java - cosmos - tests |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Member
Author
|
/azp run java - cosmos - tests |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Member
Author
|
/azp run java - cosmos - tests |
|
Azure Pipelines successfully started running 1 pipeline(s). |
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.
Previous behavior
Request-Level Consistency Override Results - Emulator
readIteminvalid overridespointQueryinvalid overrideshttps://localhost:8888/Strong,BoundedStaleness,Session,ConsistentPrefixStrong,BoundedStaleness,Session,ConsistentPrefixhttps://localhost:8888/StrongandBoundedStalenessreturned expected400;SessionandConsistentPrefixsilently succeededStrong,BoundedStaleness,Session,ConsistentPrefixhttps://localhost:9999/Strong,BoundedStaleness,Session,ConsistentPrefixStrong,BoundedStaleness,Session,ConsistentPrefixRequest-Level Consistency Override Results - Compute Gateway Live account