-
Notifications
You must be signed in to change notification settings - Fork 2.2k
[Cosmos] N-Region Synchronous Commit: Propagate SDK Supported Capabilities to BE With Data Plane and Barrier Requests #48965
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
Open
kundadebdatta
wants to merge
9
commits into
main
Choose a base branch
from
users/kundadebdatta/add_sdk_supported_capabilities
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
f079a75
Add SDK supported capabilities.
kundadebdatta ae6f0e9
Code changes to plug in the sdk supported capabilities with the barri…
kundadebdatta 48a15a5
Merge branch 'main' into users/kundadebdatta/add_sdk_supported_capabi…
kundadebdatta 8c12ef0
Improve SDKSupportedCapabilities documentation and consistency
kundadebdatta c9cc7d4
Add CHANGELOG entry for SDK supported capabilities propagation
kundadebdatta e273c61
Merge branch 'main' into users/kundadebdatta/add_sdk_supported_capabi…
kundadebdatta 7345991
Code changes to address review comments part-1.
kundadebdatta a380ad9
Merge branch 'main' into users/kundadebdatta/add_sdk_supported_capabi…
kundadebdatta 43b9a48
Merge branch 'main' into users/kundadebdatta/add_sdk_supported_capabi…
kundadebdatta File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
74 changes: 74 additions & 0 deletions
74
...mos-tests/src/test/java/com/azure/cosmos/implementation/SDKSupportedCapabilitiesTest.java
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
|
|
||
| package com.azure.cosmos.implementation; | ||
|
|
||
| import org.testng.annotations.Test; | ||
|
|
||
| import static org.assertj.core.api.Assertions.assertThat; | ||
|
|
||
| public class SDKSupportedCapabilitiesTest { | ||
|
|
||
| @Test(groups = {"unit"}) | ||
| public void capabilityBitValues() { | ||
| assertThat(HttpConstants.SDKSupportedCapabilities.NONE).isEqualTo(0L); | ||
| assertThat(HttpConstants.SDKSupportedCapabilities.PARTITION_MERGE).isEqualTo(1L); | ||
| assertThat(HttpConstants.SDKSupportedCapabilities.CHANGE_FEED_WITH_START_TIME_POST_MERGE).isEqualTo(2L); | ||
| assertThat(HttpConstants.SDKSupportedCapabilities.THROUGHPUT_BUCKETING).isEqualTo(4L); | ||
| assertThat(HttpConstants.SDKSupportedCapabilities.IGNORE_UNKNOWN_RNTBD_TOKENS).isEqualTo(8L); | ||
| assertThat(HttpConstants.SDKSupportedCapabilities.CHANGE_FEED_TOKEN_WITH_GCN).isEqualTo(16L); | ||
| } | ||
|
|
||
| @Test(groups = {"unit"}) | ||
| public void capabilityBitsDoNotOverlap() { | ||
| long[] capabilities = { | ||
| HttpConstants.SDKSupportedCapabilities.PARTITION_MERGE, | ||
| HttpConstants.SDKSupportedCapabilities.CHANGE_FEED_WITH_START_TIME_POST_MERGE, | ||
| HttpConstants.SDKSupportedCapabilities.THROUGHPUT_BUCKETING, | ||
| HttpConstants.SDKSupportedCapabilities.IGNORE_UNKNOWN_RNTBD_TOKENS, | ||
| HttpConstants.SDKSupportedCapabilities.CHANGE_FEED_TOKEN_WITH_GCN | ||
| }; | ||
|
|
||
| long combined = 0; | ||
| for (long cap : capabilities) { | ||
| // Verify no overlap with previously combined flags | ||
| assertThat(combined & cap) | ||
| .as("Capability value %d overlaps with previously seen capabilities", cap) | ||
| .isEqualTo(0L); | ||
| combined |= cap; | ||
| } | ||
| } | ||
|
|
||
| @Test(groups = {"unit"}) | ||
| public void supportedCapabilitiesIncludesExpectedFlags() { | ||
| long expected = | ||
| HttpConstants.SDKSupportedCapabilities.PARTITION_MERGE | ||
| | HttpConstants.SDKSupportedCapabilities.CHANGE_FEED_WITH_START_TIME_POST_MERGE | ||
| | HttpConstants.SDKSupportedCapabilities.IGNORE_UNKNOWN_RNTBD_TOKENS; | ||
|
|
||
| assertThat(HttpConstants.SDKSupportedCapabilities.SUPPORTED_CAPABILITIES) | ||
| .isEqualTo(String.valueOf(expected)); | ||
| } | ||
|
|
||
| @Test(groups = {"unit"}) | ||
| public void supportedCapabilitiesNone() { | ||
| assertThat(HttpConstants.SDKSupportedCapabilities.SUPPORTED_CAPABILITIES_NONE) | ||
| .isEqualTo(String.valueOf(HttpConstants.SDKSupportedCapabilities.NONE)); | ||
| assertThat(HttpConstants.SDKSupportedCapabilities.SUPPORTED_CAPABILITIES_NONE) | ||
| .isEqualTo("0"); | ||
| } | ||
|
|
||
| @Test(groups = {"unit"}) | ||
| public void supportedCapabilitiesNumericValue() { | ||
| // PARTITION_MERGE (1) | CHANGE_FEED_WITH_START_TIME_POST_MERGE (2) | IGNORE_UNKNOWN_RNTBD_TOKENS (8) = 11 | ||
| assertThat(HttpConstants.SDKSupportedCapabilities.SUPPORTED_CAPABILITIES).isEqualTo("11"); | ||
| } | ||
|
|
||
| @Test(groups = {"unit"}) | ||
| public void supportedCapabilitiesContainsIgnoreUnknownRntbdTokens() { | ||
| long value = Long.parseLong(HttpConstants.SDKSupportedCapabilities.SUPPORTED_CAPABILITIES); | ||
| assertThat(value & HttpConstants.SDKSupportedCapabilities.IGNORE_UNKNOWN_RNTBD_TOKENS) | ||
| .as("SUPPORTED_CAPABILITIES should include IGNORE_UNKNOWN_RNTBD_TOKENS flag") | ||
| .isNotEqualTo(0L); | ||
| } | ||
| } | ||
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
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
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
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
Oops, something went wrong.
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.
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.
THROU>GHPUT_BUCKETING as well?
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.
Today, the Throughput_Bucketing is used along with the Management API. Currently, we do not set it for the .NET SDK, see this code here, and wanted to keep it in sync with the .NET SDK.
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.
Yeah I think not adding throughput bucket is fine. When I was testing for rust the throughput bucket only helped with displaying and choosing the default bucket with offers. The rest works fine.