diff --git a/sdk/cosmos/azure-cosmos/CHANGELOG.md b/sdk/cosmos/azure-cosmos/CHANGELOG.md index f0b0a16d5c6b..8475b83dc5ee 100644 --- a/sdk/cosmos/azure-cosmos/CHANGELOG.md +++ b/sdk/cosmos/azure-cosmos/CHANGELOG.md @@ -3,6 +3,7 @@ ### 4.79.0-beta.1 (Unreleased) #### Features Added +* Added support for N-Region synchronous commit feature - See [PR 47757](https://github.com/Azure/azure-sdk-for-java/pull/47757) #### Breaking Changes diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/directconnectivity/StoreReader.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/directconnectivity/StoreReader.java index 06039ca583b9..e5373f1d0ef7 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/directconnectivity/StoreReader.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/directconnectivity/StoreReader.java @@ -948,6 +948,7 @@ StoreResult createStoreResult(StoreResponse storeResponse, int numberOfReadRegions = -1; Double backendLatencyInMs = null; Double retryAfterInMs = null; + long globalNRegionCommittedLSN = -1; if (replicaStatusList != null) { ImplementationBridgeHelpers @@ -995,15 +996,14 @@ StoreResult createStoreResult(StoreResponse storeResponse, numberOfReadRegions = Integer.parseInt(headerValue); } - long globalNRegionCommittedLSN = -1; headerValue = cosmosException.getResponseHeaders().get(WFConstants.BackendHeaders.GLOBAL_COMMITTED_LSN); if (!Strings.isNullOrEmpty(headerValue)) { globalCommittedLSN = Long.parseLong(headerValue); - } else { - headerValue = cosmosException.getResponseHeaders().get(WFConstants.BackendHeaders.GLOBAL_N_REGION_COMMITTED_GLSN); - if (!Strings.isNullOrEmpty(headerValue)) { - globalNRegionCommittedLSN = Long.parseLong(headerValue); - } + } + + headerValue = cosmosException.getResponseHeaders().get(WFConstants.BackendHeaders.GLOBAL_N_REGION_COMMITTED_GLSN); + if (!Strings.isNullOrEmpty(headerValue)) { + globalNRegionCommittedLSN = Long.parseLong(headerValue); } headerValue = cosmosException.getResponseHeaders().get(HttpConstants.HttpHeaders.BACKEND_REQUEST_DURATION_MILLISECONDS);