Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
a13e308
Adding a way to avoid barrier calls when at least 1 response in quoru…
jeet1995 Aug 18, 2025
d0fcc91
Adding a way to avoid barrier calls when at least 1 response in quoru…
jeet1995 Aug 18, 2025
c76ef6c
Adding a way to avoid barrier calls when at least 1 response in quoru…
jeet1995 Aug 18, 2025
acdcf66
Adding a way to avoid barrier calls when at least 1 response in quoru…
jeet1995 Aug 18, 2025
b4aa623
Adding a way to avoid barrier calls when at least 1 response in quoru…
jeet1995 Aug 18, 2025
907e3b0
Adding a way to avoid barrier calls when at least 1 response in quoru…
jeet1995 Aug 19, 2025
85bed42
Adding a way to avoid barrier calls when at least 1 response in quoru…
jeet1995 Aug 19, 2025
03e27d8
Adding a way to avoid barrier calls when at least 1 response in quoru…
jeet1995 Aug 19, 2025
ad928cc
Modifying tests.
jeet1995 Aug 19, 2025
cbf5087
Scope out barrier requests from the fail fast flow (for the time being).
jeet1995 Aug 26, 2025
9cb31e9
Fixing tests
jeet1995 Aug 29, 2025
50a1de6
Adding replicaId and error code logs.
jeet1995 Aug 29, 2025
7df4d69
Adding replicaId and error code logs.
jeet1995 Aug 29, 2025
0fc8c5e
Adding replicaId and error code logs.
jeet1995 Aug 29, 2025
dcbb5e5
Merge branch 'main' of github.com:jeet1995/azure-sdk-for-java into Le…
jeet1995 Aug 29, 2025
3b643ee
Adding replicaId and error code logs.
jeet1995 Aug 29, 2025
b3444c9
Specify work item for barrier handling on 410-1022s
jeet1995 Sep 2, 2025
03bba5b
Addressing review comments.
jeet1995 Sep 2, 2025
3b9518a
Updated CHANGELOG.md
jeet1995 Sep 2, 2025
2e9a3aa
Merge branch 'main' of github.com:jeet1995/azure-sdk-for-java into Le…
jeet1995 Sep 4, 2025
970ee2d
Addressing review comments.
jeet1995 Sep 4, 2025
e736302
Addressing review comments.
jeet1995 Sep 4, 2025
935b624
Merge branch 'main' of github.com:jeet1995/azure-sdk-for-java into Le…
jeet1995 Sep 4, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import com.azure.cosmos.implementation.GoneException;
import com.azure.cosmos.implementation.HttpConstants;
import com.azure.cosmos.implementation.InvalidPartitionException;
import com.azure.cosmos.implementation.LeaseNotFoundException;
import com.azure.cosmos.implementation.OperationType;
import com.azure.cosmos.implementation.PartitionIsMigratingException;
import com.azure.cosmos.implementation.PartitionKeyRangeIsSplittingException;
Expand Down Expand Up @@ -76,6 +77,35 @@ public void shouldRetryReadWithGoneException() {
assertThat(shouldRetryResult.backOffTime.getSeconds()).isEqualTo(4);
}

@Test(groups = { "unit" }, timeOut = TIMEOUT)
public void shouldNotRetryReadWithLeaseNotFoundException() {
RxDocumentServiceRequest request = RxDocumentServiceRequest.create(
mockDiagnosticsClientContext(),
OperationType.Read,
ResourceType.Document);
GoneAndRetryWithRetryPolicy goneAndRetryWithRetryPolicy = new GoneAndRetryWithRetryPolicy(request, 30);
Mono<ShouldRetryResult> singleShouldRetry = goneAndRetryWithRetryPolicy
.shouldRetry(new LeaseNotFoundException("0", null));
ShouldRetryResult shouldRetryResult = singleShouldRetry.block();
assertThat(shouldRetryResult.shouldRetry).isFalse();
assertThat(shouldRetryResult.policyArg.getValue0()).isTrue();
assertThat(shouldRetryResult.policyArg.getValue3()).isEqualTo(1);
assertThat(shouldRetryResult.backOffTime).isNull();

request = RxDocumentServiceRequest.create(
mockDiagnosticsClientContext(),
OperationType.Create,
ResourceType.Document);
goneAndRetryWithRetryPolicy = new GoneAndRetryWithRetryPolicy(request, 30);
singleShouldRetry = goneAndRetryWithRetryPolicy
.shouldRetry(new LeaseNotFoundException("0", null));
shouldRetryResult = singleShouldRetry.block();
assertThat(shouldRetryResult.shouldRetry).isFalse();
assertThat(shouldRetryResult.policyArg.getValue0()).isTrue();
assertThat(shouldRetryResult.policyArg.getValue3()).isEqualTo(1);
assertThat(shouldRetryResult.backOffTime).isNull();
}

/**
* Retry with GoneException for write which is not yet sent to the wire,
* retried 4 times and verified the returned
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@
import com.azure.cosmos.CosmosException;
import com.azure.cosmos.implementation.DiagnosticsClientContext;
import com.azure.cosmos.implementation.DocumentServiceRequestContext;
import com.azure.cosmos.implementation.Exceptions;
import com.azure.cosmos.implementation.FailureValidator;
import com.azure.cosmos.implementation.GoneException;
import com.azure.cosmos.implementation.HttpConstants;
import com.azure.cosmos.implementation.ISessionContainer;
import com.azure.cosmos.implementation.ISessionToken;
import com.azure.cosmos.implementation.LeaseNotFoundException;
import com.azure.cosmos.implementation.NotFoundException;
import com.azure.cosmos.implementation.OperationType;
import com.azure.cosmos.implementation.PartitionIsMigratingException;
Expand Down Expand Up @@ -149,6 +151,7 @@ public Object[][] storeResponseArgProvider() {
{ new PartitionKeyRangeIsSplittingException() , null, },
{ new PartitionIsMigratingException(), null, },
{ new GoneException(), null, },
{ new LeaseNotFoundException(null, 0L, null, null), null },
{ null, Mockito.mock(StoreResponse.class), }
};
}
Expand Down Expand Up @@ -915,9 +918,15 @@ public void storeResponseRecordedOnException(Exception ex, StoreResponse storeRe
try {
StoreReader.verifyCanContinueOnException((CosmosException) ex);

// for continuable exception, SDK will retry on all other replicas, so the failed endpoints should match replica counts.
List<Uri> expectedFailedEndpoints = Arrays.asList(primaryUri, secondaryUri1, secondaryUri2, secondaryUri3);
assertThat(dsr.requestContext.getFailedEndpoints()).hasSize(expectedFailedEndpoints.size()).containsAll(expectedFailedEndpoints);
if (Exceptions.isAvoidQuorumSelectionException((CosmosException) ex)) {
// while the exception is continuable, it is avoid quorum selection exception, so such results are collected
// while these results are not valid, they are still collected in the failed endpoints and also contribute towards decrementing replicaCountToRead to avoid quorum reselection.
assertThat(dsr.requestContext.getFailedEndpoints().size()).isEqualTo(3);
} else {
// for continuable exception, SDK will retry on all other replicas, so the failed endpoints should match replica counts.
List<Uri> expectedFailedEndpoints = Arrays.asList(primaryUri, secondaryUri1, secondaryUri2, secondaryUri3);
assertThat(dsr.requestContext.getFailedEndpoints()).hasSize(expectedFailedEndpoints.size()).containsAll(expectedFailedEndpoints);
}

} catch (Exception exception) {
if (exception instanceof CosmosException) {
Expand Down
Loading
Loading