From c0656978faa9563a8a91d5bd32e7647cdbad7518 Mon Sep 17 00:00:00 2001 From: milismsft-mac Date: Tue, 19 Nov 2019 00:55:16 -0800 Subject: [PATCH 1/4] Fix for bug reported by Walmart where an exception issued by the change feed processor when read replicas are lagging behind the primary can exit the loop earlier and stop the processing. The fix is to "catch all" exception handler to keep the loop going until the user stops the change feed processor. --- .../changefeed/implementation/PartitionLoadBalancerImpl.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionLoadBalancerImpl.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionLoadBalancerImpl.java index 9e6d93fce388..13bbf1769958 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionLoadBalancerImpl.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionLoadBalancerImpl.java @@ -131,6 +131,11 @@ private Mono run(CancellationToken cancellationToken) { }) ); }) + .onErrorResume(throwable -> { + // "catch all" exception handler to keep the loop going until the user stops the change feed processor + logger.warn("Unexpected exception thown while trying to acquire available leases", throwable); + return Mono.empty(); + }) .repeat(() -> { return !cancellationToken.isCancellationRequested(); }) From 8fab678a99a26879c1b8e55e7d630fe2b6aef9c4 Mon Sep 17 00:00:00 2001 From: milismsft-mac Date: Tue, 19 Nov 2019 21:59:01 -0800 Subject: [PATCH 2/4] Hot-fix versions update from 3.3.2 to 3.3.3 --- sdk/cosmos/README.md | 2 +- sdk/cosmos/changelog/README.md | 3 +++ sdk/cosmos/microsoft-azure-cosmos-benchmark/pom.xml | 6 +++--- sdk/cosmos/microsoft-azure-cosmos-examples/pom.xml | 6 +++--- sdk/cosmos/microsoft-azure-cosmos/pom.xml | 4 ++-- .../java/com/azure/data/cosmos/internal/HttpConstants.java | 2 +- sdk/cosmos/pom.xml | 2 +- 7 files changed, 14 insertions(+), 11 deletions(-) diff --git a/sdk/cosmos/README.md b/sdk/cosmos/README.md index 4727992f92e7..9e2af2ad5f13 100644 --- a/sdk/cosmos/README.md +++ b/sdk/cosmos/README.md @@ -92,7 +92,7 @@ For example, using maven, you can add the following dependency to your maven pom com.microsoft.azure azure-cosmos - 3.3.2 + 3.3.3 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/cosmos/changelog/README.md b/sdk/cosmos/changelog/README.md index 7edaa44a7b9c..fe522a129daf 100644 --- a/sdk/cosmos/changelog/README.md +++ b/sdk/cosmos/changelog/README.md @@ -1,5 +1,8 @@ ## Changelog +### 3.3.3 +- ChangeFeedProcessor; added a "catch all" exception handler that keeps the loop which checks and acquires available leases alive until the user stops the change feed processor. + ### 3.3.2 - ChangeFeedProcessor; fixes and extra logging related to the creations of the lease documents. - Port consistency policy bug fix (see https://github.com/Azure/azure-cosmosdb-java/pull/196) diff --git a/sdk/cosmos/microsoft-azure-cosmos-benchmark/pom.xml b/sdk/cosmos/microsoft-azure-cosmos-benchmark/pom.xml index 45410b8a565d..1f44a6457701 100644 --- a/sdk/cosmos/microsoft-azure-cosmos-benchmark/pom.xml +++ b/sdk/cosmos/microsoft-azure-cosmos-benchmark/pom.xml @@ -8,12 +8,12 @@ Licensed under the MIT License. com.microsoft.azure azure-cosmos-parent - 3.3.2 + 3.3.3 com.microsoft.azure azure-cosmos-benchmark - 3.3.2 + 3.3.3 Microsoft Azure SDK for SQL API of Azure Cosmos DB Service - Benchmarking tool This package contains Benchmarking tool for Microsoft Azure SDK for SQL API of Azure Cosmos DB Service https://github.com/Azure/azure-sdk-for-java @@ -33,7 +33,7 @@ Licensed under the MIT License. com.microsoft.azure azure-cosmos - 3.3.2 + 3.3.3 diff --git a/sdk/cosmos/microsoft-azure-cosmos-examples/pom.xml b/sdk/cosmos/microsoft-azure-cosmos-examples/pom.xml index b7abff3abccf..8cfd601bf5ee 100644 --- a/sdk/cosmos/microsoft-azure-cosmos-examples/pom.xml +++ b/sdk/cosmos/microsoft-azure-cosmos-examples/pom.xml @@ -8,12 +8,12 @@ Licensed under the MIT License. com.microsoft.azure azure-cosmos-parent - 3.3.2 + 3.3.3 com.microsoft.azure azure-cosmos-examples - 3.3.2 + 3.3.3 Microsoft Azure SDK for SQL API of Azure Cosmos DB Service - Examples This package contains examples for Microsoft Azure SDK for SQL API of Azure Cosmos DB Service https://github.com/Azure/azure-sdk-for-java @@ -89,7 +89,7 @@ Licensed under the MIT License. com.microsoft.azure azure-cosmos - 3.3.2 + 3.3.3 diff --git a/sdk/cosmos/microsoft-azure-cosmos/pom.xml b/sdk/cosmos/microsoft-azure-cosmos/pom.xml index 44b185269f64..59c184851d4f 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/pom.xml +++ b/sdk/cosmos/microsoft-azure-cosmos/pom.xml @@ -7,12 +7,12 @@ Licensed under the MIT License. com.microsoft.azure azure-cosmos-parent - 3.3.2 + 3.3.3 com.microsoft.azure azure-cosmos - 3.3.2 + 3.3.3 Microsoft Azure SDK for SQL API of Azure Cosmos DB Service This Package contains Microsoft Azure Cosmos SDK (with Reactive Extension rx support) for Azure Cosmos DB SQL API jar diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/HttpConstants.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/HttpConstants.java index 7ae29389bfba..877c692bb53b 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/HttpConstants.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/HttpConstants.java @@ -252,7 +252,7 @@ public static class Versions { // TODO: FIXME we can use maven plugin for generating a version file // @see // https://stackoverflow.com/questions/2469922/generate-a-version-java-file-in-maven - public static final String SDK_VERSION = "3.3.2"; + public static final String SDK_VERSION = "3.3.3"; public static final String SDK_NAME = "cosmosdb-java-sdk"; } diff --git a/sdk/cosmos/pom.xml b/sdk/cosmos/pom.xml index 64d84cc40737..d6e65f5c5636 100644 --- a/sdk/cosmos/pom.xml +++ b/sdk/cosmos/pom.xml @@ -13,7 +13,7 @@ Licensed under the MIT License. com.microsoft.azure azure-cosmos-parent - 3.3.2 + 3.3.3 pom Microsoft Azure Cosmos DB SQL API From c8f4a3e96c85995a1364888f18224de3179b4c23 Mon Sep 17 00:00:00 2001 From: milismsft-mac Date: Wed, 20 Nov 2019 10:59:46 -0800 Subject: [PATCH 3/4] fix spelling issue in the warning logger message --- .../changefeed/implementation/PartitionLoadBalancerImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionLoadBalancerImpl.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionLoadBalancerImpl.java index 13bbf1769958..bede463e9492 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionLoadBalancerImpl.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionLoadBalancerImpl.java @@ -133,7 +133,7 @@ private Mono run(CancellationToken cancellationToken) { }) .onErrorResume(throwable -> { // "catch all" exception handler to keep the loop going until the user stops the change feed processor - logger.warn("Unexpected exception thown while trying to acquire available leases", throwable); + logger.warn("Unexpected exception thrown while trying to acquire available leases", throwable); return Mono.empty(); }) .repeat(() -> { From 0d2042f506f60619fd9523cfd9cb5ebfdec77ec6 Mon Sep 17 00:00:00 2001 From: milismsft-mac Date: Wed, 20 Nov 2019 13:31:00 -0800 Subject: [PATCH 4/4] Ported PR #6352 - Fixed emulator breaking change test --- .../com/azure/data/cosmos/rx/CollectionCrudTest.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/CollectionCrudTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/CollectionCrudTest.java index ddd5157eb6fb..9442ab24d810 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/CollectionCrudTest.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/CollectionCrudTest.java @@ -35,6 +35,7 @@ import reactor.core.publisher.Mono; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import java.util.UUID; @@ -83,7 +84,7 @@ private CosmosContainerProperties getCollectionDefinition(String collectionName) @Test(groups = { "emulator" }, timeOut = TIMEOUT, dataProvider = "collectionCrudArgProvider") public void createCollection(String collectionName) throws InterruptedException { CosmosContainerProperties collectionDefinition = getCollectionDefinition(collectionName); - + Mono createObservable = database .createContainer(collectionDefinition); @@ -146,14 +147,12 @@ public void createCollectionWithCompositeIndexAndSpatialSpec() throws Interrupte }; List spatialIndexes = new ArrayList(); for (int index = 0; index < 2; index++) { - List collectionOfSpatialTypes = new ArrayList(); SpatialSpec spec = new SpatialSpec(); spec.path("/path" + index + "/*"); - for (int i = index; i < index + 3; i++) { - collectionOfSpatialTypes.add(spatialTypes[i]); - } + List collectionOfSpatialTypes = new ArrayList(Arrays.asList(spatialTypes).subList(0, index + 3)); + spec.spatialTypes(collectionOfSpatialTypes); spatialIndexes.add(spec); }