From 8b1b299c2d524963ef51dc0e408e072948a182fe Mon Sep 17 00:00:00 2001 From: Kushagra Thapar Date: Wed, 6 Nov 2024 11:15:32 -0800 Subject: [PATCH 1/4] Updated the minimum recommended version --- sdk/cosmos/azure-cosmos-kafka-connect/CHANGELOG.md | 3 +++ sdk/cosmos/azure-cosmos-spark_3-1_2-12/CHANGELOG.md | 5 ++--- sdk/cosmos/azure-cosmos-spark_3-2_2-12/CHANGELOG.md | 5 ++--- sdk/cosmos/azure-cosmos-spark_3-3_2-12/CHANGELOG.md | 3 ++- sdk/cosmos/azure-cosmos-spark_3-4_2-12/CHANGELOG.md | 3 ++- sdk/cosmos/azure-cosmos-spark_3-5_2-12/CHANGELOG.md | 3 ++- sdk/cosmos/azure-cosmos/CHANGELOG.md | 6 +++--- .../ContainerThroughputControlGroupProperties.java | 5 ++++- sdk/spring/azure-spring-data-cosmos/CHANGELOG.md | 2 -- 9 files changed, 20 insertions(+), 15 deletions(-) diff --git a/sdk/cosmos/azure-cosmos-kafka-connect/CHANGELOG.md b/sdk/cosmos/azure-cosmos-kafka-connect/CHANGELOG.md index 7a8dd37d2099d..e4f985fb203c3 100644 --- a/sdk/cosmos/azure-cosmos-kafka-connect/CHANGELOG.md +++ b/sdk/cosmos/azure-cosmos-kafka-connect/CHANGELOG.md @@ -2,6 +2,9 @@ ### 2.0.0 (2024-11-04) +#### Features Added +* General Availability release of the Source and Sink Kafka Connectors - See [PR 42785](https://github.com/Azure/azure-sdk-for-java/pull/42785) + #### Other Changes * Improved error message when the database provided in the config does not exist - See [PR 42599](https://github.com/Azure/azure-sdk-for-java/pull/42599) diff --git a/sdk/cosmos/azure-cosmos-spark_3-1_2-12/CHANGELOG.md b/sdk/cosmos/azure-cosmos-spark_3-1_2-12/CHANGELOG.md index 2a42193a5444d..72ad2af6e22c8 100644 --- a/sdk/cosmos/azure-cosmos-spark_3-1_2-12/CHANGELOG.md +++ b/sdk/cosmos/azure-cosmos-spark_3-1_2-12/CHANGELOG.md @@ -11,7 +11,8 @@ #### Other Changes ### 4.34.0 (2024-10-10) - +> [!IMPORTANT] +> We strongly recommend our customers to use version 4.34.0 and above. #### Bugs Fixed * Fixed an issue to avoid transient `IllegalArgumentException` due to duplicate json properties for the `uniqueKeyPolicy` property in `DocumentCollection`. - See [PR 41608](https://github.com/Azure/azure-sdk-for-java/pull/41608) and [PR 42244](https://github.com/Azure/azure-sdk-for-java/pull/42244) @@ -238,8 +239,6 @@ * Reduced the logging noise level on CancellationExceptions from `RntbdReporter.reportIssue`. - See [PR 32175](https://github.com/Azure/azure-sdk-for-java/pull/32175) ### 4.14.1 (2022-10-07) -> [!IMPORTANT] -> We strongly recommend our customers to use version 4.14.1 and above. #### Bugs Fixed * Fixed incorrect RU metric reporting in micrometer metrics. - See [PR 31307](https://github.com/Azure/azure-sdk-for-java/pull/31307) diff --git a/sdk/cosmos/azure-cosmos-spark_3-2_2-12/CHANGELOG.md b/sdk/cosmos/azure-cosmos-spark_3-2_2-12/CHANGELOG.md index fe5b1a8029c2f..c21623a209e5b 100644 --- a/sdk/cosmos/azure-cosmos-spark_3-2_2-12/CHANGELOG.md +++ b/sdk/cosmos/azure-cosmos-spark_3-2_2-12/CHANGELOG.md @@ -11,7 +11,8 @@ #### Other Changes ### 4.34.0 (2024-10-10) - +> [!IMPORTANT] +> We strongly recommend our customers to use version 4.34.0 and above. #### Bugs Fixed * Fixed an issue to avoid transient `IllegalArgumentException` due to duplicate json properties for the `uniqueKeyPolicy` property in `DocumentCollection`. - See [PR 41608](https://github.com/Azure/azure-sdk-for-java/pull/41608) and [PR 42244](https://github.com/Azure/azure-sdk-for-java/pull/42244) @@ -242,8 +243,6 @@ * Reduced the logging noise level on CancellationExceptions from `RntbdReporter.reportIssue`. - See [PR 32175](https://github.com/Azure/azure-sdk-for-java/pull/32175) ### 4.14.1 (2022-10-07) -> [!IMPORTANT] -> We strongly recommend our customers to use version 4.14.1 and above. #### Bugs Fixed * Fixed incorrect RU metric reporting in micrometer metrics. - See [PR 31307](https://github.com/Azure/azure-sdk-for-java/pull/31307) diff --git a/sdk/cosmos/azure-cosmos-spark_3-3_2-12/CHANGELOG.md b/sdk/cosmos/azure-cosmos-spark_3-3_2-12/CHANGELOG.md index 368795ed87ccb..e920fd1572f89 100644 --- a/sdk/cosmos/azure-cosmos-spark_3-3_2-12/CHANGELOG.md +++ b/sdk/cosmos/azure-cosmos-spark_3-3_2-12/CHANGELOG.md @@ -11,7 +11,8 @@ #### Other Changes ### 4.34.0 (2024-10-10) - +> [!IMPORTANT] +> We strongly recommend our customers to use version 4.34.0 and above. #### Bugs Fixed * Fixed an issue to avoid transient `IllegalArgumentException` due to duplicate json properties for the `uniqueKeyPolicy` property in `DocumentCollection`. - See [PR 41608](https://github.com/Azure/azure-sdk-for-java/pull/41608) and [PR 42244](https://github.com/Azure/azure-sdk-for-java/pull/42244) diff --git a/sdk/cosmos/azure-cosmos-spark_3-4_2-12/CHANGELOG.md b/sdk/cosmos/azure-cosmos-spark_3-4_2-12/CHANGELOG.md index 4659158e0ddbf..276adeb27d8ef 100644 --- a/sdk/cosmos/azure-cosmos-spark_3-4_2-12/CHANGELOG.md +++ b/sdk/cosmos/azure-cosmos-spark_3-4_2-12/CHANGELOG.md @@ -11,7 +11,8 @@ #### Other Changes ### 4.34.0 (2024-10-10) - +> [!IMPORTANT] +> We strongly recommend our customers to use version 4.34.0 and above. #### Bugs Fixed * Fixed an issue to avoid transient `IllegalArgumentException` due to duplicate json properties for the `uniqueKeyPolicy` property in `DocumentCollection`. - See [PR 41608](https://github.com/Azure/azure-sdk-for-java/pull/41608) and [PR 42244](https://github.com/Azure/azure-sdk-for-java/pull/42244) diff --git a/sdk/cosmos/azure-cosmos-spark_3-5_2-12/CHANGELOG.md b/sdk/cosmos/azure-cosmos-spark_3-5_2-12/CHANGELOG.md index e39131eb222ef..8829b806e7472 100644 --- a/sdk/cosmos/azure-cosmos-spark_3-5_2-12/CHANGELOG.md +++ b/sdk/cosmos/azure-cosmos-spark_3-5_2-12/CHANGELOG.md @@ -11,7 +11,8 @@ #### Other Changes ### 4.34.0 (2024-10-10) - +> [!IMPORTANT] +> We strongly recommend our customers to use version 4.34.0 and above. #### Bugs Fixed * Fixed an issue to avoid transient `IllegalArgumentException` due to duplicate json properties for the `uniqueKeyPolicy` property in `DocumentCollection`. - See [PR 41608](https://github.com/Azure/azure-sdk-for-java/pull/41608) and [PR 42244](https://github.com/Azure/azure-sdk-for-java/pull/42244) diff --git a/sdk/cosmos/azure-cosmos/CHANGELOG.md b/sdk/cosmos/azure-cosmos/CHANGELOG.md index b52012a13cac2..3c1f21692607f 100644 --- a/sdk/cosmos/azure-cosmos/CHANGELOG.md +++ b/sdk/cosmos/azure-cosmos/CHANGELOG.md @@ -7,6 +7,7 @@ #### Breaking Changes #### Bugs Fixed +* Fixed a Null Pointer Exception in `ContainerThroughputConrolGroupProperties` if defaultGroup is not set. - See [PR 42900]() #### Other Changes * Enable `JsonParser.Feature.ALLOW_UNQUOTED_CONTROL_CHARS` by default for objectMapper. - See [PR 42520](https://github.com/Azure/azure-sdk-for-java/pull/42520) @@ -21,7 +22,8 @@ * Fixed an issue where holding onto a `CosmosException` instance would hold a strong reference to a `RxDocumentClientImpl` instance preventing garbage collection of the `RxDocumentClientImpl` instance. - See [PR 42178](https://github.com/Azure/azure-sdk-for-java/pull/42178) ### 4.64.0 (2024-10-10) - +> [!IMPORTANT] +> We strongly recommend our customers to use version 4.64.0 and above. #### Features Added * Added an API to retrieve diagnostics from the change feed processor context. - See [PR 41738](https://github.com/Azure/azure-sdk-for-java/pull/41738) * Added support to allow `queryChangeFeed` to complete when all changes available when the query starts have been fetched. - See [PR 42160](https://github.com/Azure/azure-sdk-for-java/pull/42160) @@ -319,8 +321,6 @@ * Fixed possible `NullPointerException` issue if health-check flow kicks in before RNTBD context negotiation for a given channel - See [PR 36397](https://github.com/Azure/azure-sdk-for-java/pull/36397). ### 4.48.2 (2023-08-25) -> [!IMPORTANT] -> We strongly recommend our customers to use version 4.48.2 and above. #### Bugs Fixed * Fixed possible `NullPointerException` issue if health-check flow kicks in before RNTBD context negotiation for a given channel - See [PR 36397](https://github.com/Azure/azure-sdk-for-java/pull/36397). diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/throughputControl/ContainerThroughputControlGroupProperties.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/throughputControl/ContainerThroughputControlGroupProperties.java index 31e764205063c..d67f0e400266b 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/throughputControl/ContainerThroughputControlGroupProperties.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/throughputControl/ContainerThroughputControlGroupProperties.java @@ -109,7 +109,10 @@ public boolean allowRequestToContinueOnInitError(RxDocumentServiceRequest reques String requestGroupName = request.getThroughputControlGroupName(); if (StringUtils.isEmpty(requestGroupName)) { - requestGroupName = this.defaultGroup.get().getGroupName(); + if (defaultGroup.get() == null) { + return true; + } + requestGroupName = defaultGroup.get().getGroupName(); } return this.supressInitErrorGroupSet.contains(requestGroupName); diff --git a/sdk/spring/azure-spring-data-cosmos/CHANGELOG.md b/sdk/spring/azure-spring-data-cosmos/CHANGELOG.md index 21ba146b23c44..468402dfb07ff 100644 --- a/sdk/spring/azure-spring-data-cosmos/CHANGELOG.md +++ b/sdk/spring/azure-spring-data-cosmos/CHANGELOG.md @@ -284,8 +284,6 @@ * Updated `azure-cosmos` to version `4.38.0`. ### 3.28.1 (2022-10-07) -> [!IMPORTANT] -> We strongly recommend our customers to use version 3.28.1 and above. #### Other Changes * Updated `azure-cosmos` to version `4.37.1`. From add3968c7af1a86883958c6581d7cd072d4e4d29 Mon Sep 17 00:00:00 2001 From: Kushagra Thapar Date: Wed, 6 Nov 2024 11:20:29 -0800 Subject: [PATCH 2/4] Merged latest main --- sdk/spring/azure-spring-data-cosmos/CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sdk/spring/azure-spring-data-cosmos/CHANGELOG.md b/sdk/spring/azure-spring-data-cosmos/CHANGELOG.md index 329ae66ac431e..f84882e41497c 100644 --- a/sdk/spring/azure-spring-data-cosmos/CHANGELOG.md +++ b/sdk/spring/azure-spring-data-cosmos/CHANGELOG.md @@ -12,7 +12,8 @@ #### Other Changes ### 5.18.0 (2024-11-05) - +> [!IMPORTANT] +> We strongly recommend our customers to use version 5.18.0 and above. #### Other Changes * Updated `azure-cosmos` to version `4.64.0`. From 7682e9d41c52d5ec9684c7b12f5caa335bcfa418 Mon Sep 17 00:00:00 2001 From: Kushagra Thapar Date: Wed, 6 Nov 2024 11:23:40 -0800 Subject: [PATCH 3/4] Updated min recommended versions for java sdk and updated the PR link --- sdk/cosmos/azure-cosmos/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/cosmos/azure-cosmos/CHANGELOG.md b/sdk/cosmos/azure-cosmos/CHANGELOG.md index 3c1f21692607f..3f0316893270f 100644 --- a/sdk/cosmos/azure-cosmos/CHANGELOG.md +++ b/sdk/cosmos/azure-cosmos/CHANGELOG.md @@ -7,7 +7,7 @@ #### Breaking Changes #### Bugs Fixed -* Fixed a Null Pointer Exception in `ContainerThroughputConrolGroupProperties` if defaultGroup is not set. - See [PR 42900]() +* Fixed a Null Pointer Exception in `ContainerThroughputConrolGroupProperties` if defaultGroup is not set. - See [PR 42835](https://github.com/Azure/azure-sdk-for-java/pull/42835) #### Other Changes * Enable `JsonParser.Feature.ALLOW_UNQUOTED_CONTROL_CHARS` by default for objectMapper. - See [PR 42520](https://github.com/Azure/azure-sdk-for-java/pull/42520) From a5aae019b54e42ca5adc706c9987de943aa5d827 Mon Sep 17 00:00:00 2001 From: Kushagra Thapar Date: Thu, 7 Nov 2024 17:17:50 -0800 Subject: [PATCH 4/4] Added tests for container throughput control group properties --- ...ThroughputControlGroupPropertiesTests.java | 111 +++++++++++------- 1 file changed, 70 insertions(+), 41 deletions(-) diff --git a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/implementation/throughputControl/ContainerThroughputControlGroupPropertiesTests.java b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/implementation/throughputControl/ContainerThroughputControlGroupPropertiesTests.java index b69d1f732bbea..9c8965c0610db 100644 --- a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/implementation/throughputControl/ContainerThroughputControlGroupPropertiesTests.java +++ b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/implementation/throughputControl/ContainerThroughputControlGroupPropertiesTests.java @@ -6,10 +6,12 @@ import com.azure.cosmos.CosmosAsyncClient; import com.azure.cosmos.CosmosAsyncContainer; import com.azure.cosmos.CosmosClientBuilder; +import com.azure.cosmos.implementation.RxDocumentServiceRequest; import com.azure.cosmos.implementation.TestConfigurations; import com.azure.cosmos.implementation.apachecommons.lang.tuple.Pair; import com.azure.cosmos.implementation.throughputControl.config.LocalThroughputControlGroup; import com.azure.cosmos.models.PriorityLevel; +import org.mockito.Mockito; import org.testng.annotations.Test; import java.util.UUID; @@ -24,9 +26,9 @@ public void enableThroughputControlGroup() { CosmosAsyncClient testClient = null; try { testClient = new CosmosClientBuilder() - .endpoint(TestConfigurations.HOST) - .key(TestConfigurations.MASTER_KEY) - .buildAsyncClient(); + .endpoint(TestConfigurations.HOST) + .key(TestConfigurations.MASTER_KEY) + .buildAsyncClient(); ContainerThroughputControlGroupProperties throughputControlContainerProperties = new ContainerThroughputControlGroupProperties("/testDB/testContainer"); @@ -35,13 +37,13 @@ public void enableThroughputControlGroup() { // Test 1: add default throughput control group successfully LocalThroughputControlGroup throughputControlDefaultGroup = new LocalThroughputControlGroup( - "test-" + UUID.randomUUID(), - container, - 6, - null, - PriorityLevel.HIGH, - true, - false); + "test-" + UUID.randomUUID(), + container, + 6, + null, + PriorityLevel.HIGH, + true, + false); Pair stateAfterEnabling = throughputControlContainerProperties.enableThroughputControlGroup(throughputControlDefaultGroup, null); @@ -53,13 +55,13 @@ public void enableThroughputControlGroup() { // Test 2: add throughput control group with same id, but different values for immutable // properties isDefault or continueOnError LocalThroughputControlGroup throughputControlGroupDuplicate1 = new LocalThroughputControlGroup( - throughputControlDefaultGroup.getGroupName(), - container, - 6, - null, - PriorityLevel.HIGH, - false, - false); + throughputControlDefaultGroup.getGroupName(), + container, + 6, + null, + PriorityLevel.HIGH, + false, + false); assertThatThrownBy( () -> throughputControlContainerProperties @@ -83,26 +85,26 @@ public void enableThroughputControlGroup() { // Test 3: add another default group LocalThroughputControlGroup throughputControlDefaultGroup2 = new LocalThroughputControlGroup( - "test-" + UUID.randomUUID(), - container, - 6, - null, - PriorityLevel.HIGH, - true, - false); + "test-" + UUID.randomUUID(), + container, + 6, + null, + PriorityLevel.HIGH, + true, + false); assertThatThrownBy(() -> throughputControlContainerProperties.enableThroughputControlGroup(throughputControlDefaultGroup2, null)) - .isInstanceOf(IllegalArgumentException.class) - .hasMessage("A default group already exists"); + .isInstanceOf(IllegalArgumentException.class) + .hasMessage("A default group already exists"); // Test 4: add a new group LocalThroughputControlGroup newGroup = new LocalThroughputControlGroup( - "test-" + UUID.randomUUID(), - container, - 6, - null, - PriorityLevel.HIGH, - false, - false); + "test-" + UUID.randomUUID(), + container, + 6, + null, + PriorityLevel.HIGH, + false, + false); stateAfterEnabling = throughputControlContainerProperties.enableThroughputControlGroup(newGroup, null); currentGroupSize = stateAfterEnabling.getLeft(); @@ -112,13 +114,13 @@ public void enableThroughputControlGroup() { // Test 5: add a same group as step 4 LocalThroughputControlGroup newGroupDuplicate = new LocalThroughputControlGroup( - newGroup.getGroupName(), - container, - newGroup.getTargetThroughput(), - newGroup.getTargetThroughputThreshold(), - PriorityLevel.HIGH, - newGroup.isDefault(), - newGroup.isContinueOnInitError()); + newGroup.getGroupName(), + container, + newGroup.getTargetThroughput(), + newGroup.getTargetThroughputThreshold(), + PriorityLevel.HIGH, + newGroup.isDefault(), + newGroup.isContinueOnInitError()); stateAfterEnabling = throughputControlContainerProperties.enableThroughputControlGroup(newGroupDuplicate, null); currentGroupSize = stateAfterEnabling.getLeft(); @@ -136,7 +138,8 @@ public void enableThroughputControlGroup() { newGroup.isDefault(), newGroup.isContinueOnInitError()); stateAfterEnabling = - throughputControlContainerProperties.enableThroughputControlGroup(newGroupDuplicateModifiedTarget, null); + throughputControlContainerProperties.enableThroughputControlGroup(newGroupDuplicateModifiedTarget, + null); currentGroupSize = stateAfterEnabling.getLeft(); wasGroupConfigUpdated = stateAfterEnabling.getRight(); assertThat(currentGroupSize).isEqualTo(2); @@ -147,4 +150,30 @@ public void enableThroughputControlGroup() { } } } + + @Test(groups = "emulator") + public void enableThroughputControlGroupWithoutDefault() { + CosmosAsyncClient testClient = null; + try { + testClient = new CosmosClientBuilder() + .endpoint(TestConfigurations.HOST) + .key(TestConfigurations.MASTER_KEY) + .buildAsyncClient(); + + ContainerThroughputControlGroupProperties throughputControlContainerProperties = + new ContainerThroughputControlGroupProperties("/testDB/testContainer"); + + // Test: Without default group and request not having the group name, allowRequestToContinueOnInitError + // should not throw NPE + boolean allowRequestToContinue = + throughputControlContainerProperties.allowRequestToContinueOnInitError(Mockito.mock(RxDocumentServiceRequest.class)); + + assertThat(allowRequestToContinue).isTrue(); + + } finally { + if (testClient != null) { + testClient.close(); + } + } + } }