Skip to content
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

MaxRetryCountTest+[BUG]404/1002CyclicRegionRetry+[BUG]449RetryTooAggressively +[BUG]MissingCrossRegionRetryForWritesWithServer410 #37050) #37040

Merged
merged 33 commits into from
Oct 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
86eb7f1
Update platform-matrix.json
FabianMeiswinkel Oct 2, 2023
0e9dcda
Update FaultInjectionWithAvailabilityStrategyTests.java
FabianMeiswinkel Oct 2, 2023
0aca208
Update FaultInjectionWithAvailabilityStrategyTests.java
FabianMeiswinkel Oct 2, 2023
74e6748
Revert "Update platform-matrix.json"
FabianMeiswinkel Oct 2, 2023
786c64e
Update FaultInjectionWithAvailabilityStrategyTests.java
FabianMeiswinkel Oct 3, 2023
0da26b2
Update FaultInjectionWithAvailabilityStrategyTests.java
FabianMeiswinkel Oct 3, 2023
d51b12f
Merge branch 'main' of https://github.com/Azure/azure-sdk-for-java in…
FabianMeiswinkel Oct 4, 2023
fe95e0a
MaxRetryCountTest skeleton
FabianMeiswinkel Oct 4, 2023
24e5c2b
Fixing ClientRetryPolicy for MM
FabianMeiswinkel Oct 4, 2023
686daa5
Adding MaxMicroBatchSize config and siwtching BulKWriter to use buffe…
FabianMeiswinkel Oct 6, 2023
ee0af3a
Revert "Adding MaxMicroBatchSize config and siwtching BulKWriter to u…
FabianMeiswinkel Oct 6, 2023
8012dc9
add 449 test case and fix 449 aggressive retry issue
Oct 6, 2023
8dd57db
add server 410 test cases
Oct 6, 2023
9e8f51d
add transit timeout tests
Oct 7, 2023
ef7f43d
correct retry count for bounded staleness
Oct 9, 2023
a790188
add tests for 503, 500, 429
Oct 9, 2023
4639f5d
fix compilation issue
Oct 10, 2023
62c9f1c
retry 503/0 for writes
Oct 10, 2023
21839d1
Merge branch 'main' into users/fabianm/maxRetryCount
Oct 10, 2023
ee0857d
resolve comments
Oct 11, 2023
9138810
resolve comments
Oct 13, 2023
b943abf
Merge branch 'main' into users/fabianm/maxRetryCount
Oct 13, 2023
509dc62
update changelog
Oct 13, 2023
1d81a11
fix tests
Oct 14, 2023
32f6df5
fix failed tests
Oct 16, 2023
ccccc96
resolve conflicts
Oct 16, 2023
a38a420
fix tests
Oct 17, 2023
d8d5d13
fix SessionNotAvailableRetryTests
Oct 17, 2023
ac45abb
fix FaultInjectionWithAvailabilityStrategyTests
Oct 17, 2023
9993d1d
merge from main and resolve conflicts
Oct 19, 2023
9335307
refactor
Oct 19, 2023
1e918d9
fix tests
Oct 19, 2023
b19447e
fix tests
Oct 20, 2023
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 @@ -90,6 +90,8 @@ public CosmosException getInjectedServerError(RxDocumentServiceRequest request)
responseHeaders.put(
HttpConstants.HttpHeaders.RETRY_AFTER_IN_MILLISECONDS,
String.valueOf(500));
responseHeaders.put(WFConstants.BackendHeaders.SUB_STATUS,
Integer.toString(HttpConstants.SubStatusCodes.USER_REQUEST_RATE_TOO_LARGE));
cosmosException = new RequestRateTooLargeException(null, lsn, partitionKeyRangeId, responseHeaders);

break;
Expand Down Expand Up @@ -137,7 +139,8 @@ public CosmosException getInjectedServerError(RxDocumentServiceRequest request)
case SERVICE_UNAVAILABLE:
responseHeaders.put(WFConstants.BackendHeaders.SUB_STATUS,
Integer.toString(HttpConstants.SubStatusCodes.SERVER_GENERATED_503));
cosmosException = new ServiceUnavailableException(null, lsn, null, responseHeaders, HttpConstants.SubStatusCodes.SERVER_GENERATED_503);
cosmosException =
new ServiceUnavailableException(null, lsn, null, responseHeaders, HttpConstants.SubStatusCodes.SERVER_GENERATED_503);
break;

case STALED_ADDRESSES_SERVER_GONE:
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -1099,9 +1099,9 @@ public Object[][] regionExclusionWriteAfterCreateTestConfigs() {
this.chooseFirstRegion.apply(this.preferredRegions)
))
.withExpectedResultAfterMutation(new ExpectedResult(
HttpConstants.StatusCodes.SERVICE_UNAVAILABLE,
HttpConstants.SubStatusCodes.SERVER_GENERATED_503,
this.chooseFirstRegion.apply(this.preferredRegions)
HttpConstants.StatusCodes.CREATED,
HttpConstants.SubStatusCodes.UNKNOWN,
this.chooseAllRegions.apply(this.preferredRegions)
)),
},
{
Expand Down Expand Up @@ -1159,9 +1159,9 @@ public Object[][] regionExclusionWriteAfterCreateTestConfigs() {
this.chooseFirstRegion.apply(this.preferredRegions)
))
.withExpectedResultAfterMutation(new ExpectedResult(
HttpConstants.StatusCodes.SERVICE_UNAVAILABLE,
HttpConstants.SubStatusCodes.SERVER_GENERATED_503,
this.chooseFirstRegion.apply(this.preferredRegions)
HttpConstants.StatusCodes.OK,
HttpConstants.SubStatusCodes.UNKNOWN,
this.chooseAllRegions.apply(this.preferredRegions)
)),
},
{
Expand Down Expand Up @@ -1224,9 +1224,9 @@ public Object[][] regionExclusionWriteAfterCreateTestConfigs() {
this.chooseFirstRegion.apply(this.preferredRegions)
))
.withExpectedResultAfterMutation(new ExpectedResult(
HttpConstants.StatusCodes.SERVICE_UNAVAILABLE,
HttpConstants.SubStatusCodes.SERVER_GENERATED_503,
this.chooseFirstRegion.apply(this.preferredRegions)
HttpConstants.StatusCodes.OK,
HttpConstants.SubStatusCodes.UNKNOWN,
this.chooseAllRegions.apply(this.preferredRegions)
)),
},
{
Expand Down Expand Up @@ -1266,9 +1266,9 @@ public Object[][] regionExclusionWriteAfterCreateTestConfigs() {
this.chooseFirstRegion.apply(this.preferredRegions)
))
.withExpectedResultAfterMutation(new ExpectedResult(
HttpConstants.StatusCodes.SERVICE_UNAVAILABLE,
HttpConstants.SubStatusCodes.SERVER_GENERATED_503,
this.chooseFirstRegion.apply(this.preferredRegions)
HttpConstants.StatusCodes.CREATED,
HttpConstants.SubStatusCodes.UNKNOWN,
this.chooseAllRegions.apply(this.preferredRegions)
)),
},
{
Expand Down Expand Up @@ -1308,9 +1308,9 @@ public Object[][] regionExclusionWriteAfterCreateTestConfigs() {
this.chooseFirstRegion.apply(this.preferredRegions)
))
.withExpectedResultAfterMutation(new ExpectedResult(
HttpConstants.StatusCodes.SERVICE_UNAVAILABLE,
HttpConstants.SubStatusCodes.SERVER_GENERATED_503,
this.chooseFirstRegion.apply(this.preferredRegions)
HttpConstants.StatusCodes.NO_CONTENT,
HttpConstants.SubStatusCodes.UNKNOWN,
this.chooseAllRegions.apply(this.preferredRegions)
)),
},
{
Expand Down Expand Up @@ -1350,9 +1350,9 @@ public Object[][] regionExclusionWriteAfterCreateTestConfigs() {
this.chooseFirstRegion.apply(this.preferredRegions)
))
.withExpectedResultAfterMutation(new ExpectedResult(
HttpConstants.StatusCodes.SERVICE_UNAVAILABLE,
HttpConstants.SubStatusCodes.SERVER_GENERATED_503,
this.chooseFirstRegion.apply(this.preferredRegions)
HttpConstants.StatusCodes.OK,
HttpConstants.SubStatusCodes.UNKNOWN,
this.chooseAllRegions.apply(this.preferredRegions)
)),
},
{
Expand Down Expand Up @@ -1668,9 +1668,10 @@ public Object[][] regionExclusionBatchTestConfigs() {
this.chooseLastRegion.apply(this.preferredRegions)
))
.withExpectedResultAfterMutation(new ExpectedResult(
HttpConstants.StatusCodes.SERVICE_UNAVAILABLE,
HttpConstants.SubStatusCodes.SERVER_GENERATED_503,
this.chooseFirstRegion.apply(this.preferredRegions)
HttpConstants.StatusCodes.OK,
HttpConstants.SubStatusCodes.UNKNOWN,
2,
this.chooseFirstTwoRegions.apply(this.preferredRegions)
))
},
{
Expand All @@ -1689,9 +1690,10 @@ public Object[][] regionExclusionBatchTestConfigs() {
this.chooseLastRegion.apply(this.preferredRegions)
))
.withExpectedResultAfterMutation(new ExpectedResult(
HttpConstants.StatusCodes.SERVICE_UNAVAILABLE,
HttpConstants.SubStatusCodes.SERVER_GENERATED_503,
this.chooseFirstRegion.apply(this.preferredRegions)
HttpConstants.StatusCodes.OK,
HttpConstants.SubStatusCodes.UNKNOWN,
2,
this.chooseFirstTwoRegions.apply(this.preferredRegions)
))
},
{
Expand Down Expand Up @@ -2035,9 +2037,9 @@ public Object[][] regionExclusionBulkTestConfigs() {
this.chooseLastRegion.apply(this.preferredRegions)
))
.withExpectedResultAfterMutation(new ExpectedResult(
HttpConstants.StatusCodes.SERVICE_UNAVAILABLE,
HttpConstants.SubStatusCodes.SERVER_GENERATED_503,
this.chooseFirstRegion.apply(this.preferredRegions)
HttpConstants.StatusCodes.OK,
HttpConstants.SubStatusCodes.UNKNOWN,
this.chooseFirstTwoRegions.apply(this.preferredRegions)
))
},
{
Expand All @@ -2055,9 +2057,9 @@ public Object[][] regionExclusionBulkTestConfigs() {
this.chooseLastRegion.apply(this.preferredRegions)
))
.withExpectedResultAfterMutation(new ExpectedResult(
HttpConstants.StatusCodes.SERVICE_UNAVAILABLE,
HttpConstants.SubStatusCodes.SERVER_GENERATED_503,
this.chooseFirstRegion.apply(this.preferredRegions)
HttpConstants.StatusCodes.OK,
HttpConstants.SubStatusCodes.UNKNOWN,
this.chooseFirstTwoRegions.apply(this.preferredRegions)
))
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public static Object[][] faultInjectionServerErrorResponseProvider() {
{ OperationType.Read, FaultInjectionOperationType.READ_ITEM, FaultInjectionServerErrorType.GONE, true, 410, HttpConstants.SubStatusCodes.SERVER_GENERATED_410 },
{ OperationType.Read, FaultInjectionOperationType.READ_ITEM, FaultInjectionServerErrorType.INTERNAL_SERVER_ERROR, false, 500, 0 },
{ OperationType.Read, FaultInjectionOperationType.READ_ITEM, FaultInjectionServerErrorType.RETRY_WITH, true, 449, 0 },
{ OperationType.Read, FaultInjectionOperationType.READ_ITEM, FaultInjectionServerErrorType.TOO_MANY_REQUEST, true, 429, 0 },
{ OperationType.Read, FaultInjectionOperationType.READ_ITEM, FaultInjectionServerErrorType.TOO_MANY_REQUEST, true, 429, HttpConstants.SubStatusCodes.USER_REQUEST_RATE_TOO_LARGE },
{ OperationType.Read, FaultInjectionOperationType.READ_ITEM, FaultInjectionServerErrorType.READ_SESSION_NOT_AVAILABLE, true, 404, 1002 },
{ OperationType.Read, FaultInjectionOperationType.READ_ITEM, FaultInjectionServerErrorType.TIMEOUT, true, 410, HttpConstants.SubStatusCodes.SERVER_GENERATED_408 }, // for server return 408, SDK will wrap into 410/21010
{ OperationType.Read, FaultInjectionOperationType.READ_ITEM, FaultInjectionServerErrorType.PARTITION_IS_MIGRATING, true, 410, 1008 },
Expand All @@ -133,7 +133,7 @@ public static Object[][] faultInjectionServerErrorResponseProvider() {
{ OperationType.ReadFeed, FaultInjectionOperationType.READ_FEED_ITEM, FaultInjectionServerErrorType.GONE, true, 410, HttpConstants.SubStatusCodes.SERVER_GENERATED_410 },
{ OperationType.ReadFeed, FaultInjectionOperationType.READ_FEED_ITEM, FaultInjectionServerErrorType.INTERNAL_SERVER_ERROR, false, 500, 0 },
{ OperationType.ReadFeed, FaultInjectionOperationType.READ_FEED_ITEM, FaultInjectionServerErrorType.RETRY_WITH, true, 449, 0 },
{ OperationType.ReadFeed, FaultInjectionOperationType.READ_FEED_ITEM, FaultInjectionServerErrorType.TOO_MANY_REQUEST, true, 429, 0 },
{ OperationType.ReadFeed, FaultInjectionOperationType.READ_FEED_ITEM, FaultInjectionServerErrorType.TOO_MANY_REQUEST, true, 429, HttpConstants.SubStatusCodes.USER_REQUEST_RATE_TOO_LARGE },
{ OperationType.ReadFeed, FaultInjectionOperationType.READ_FEED_ITEM, FaultInjectionServerErrorType.READ_SESSION_NOT_AVAILABLE, true, 404, 1002 },
{ OperationType.ReadFeed, FaultInjectionOperationType.READ_FEED_ITEM, FaultInjectionServerErrorType.TIMEOUT, true, 410, HttpConstants.SubStatusCodes.SERVER_GENERATED_408 }, // for server return 408, SDK will wrap into 410/21010
{ OperationType.ReadFeed, FaultInjectionOperationType.READ_FEED_ITEM, FaultInjectionServerErrorType.PARTITION_IS_MIGRATING, true, 410, 1008 },
Expand All @@ -142,7 +142,7 @@ public static Object[][] faultInjectionServerErrorResponseProvider() {
{ OperationType.Create, FaultInjectionOperationType.CREATE_ITEM, FaultInjectionServerErrorType.GONE, true, 410, HttpConstants.SubStatusCodes.SERVER_GENERATED_410 },
{ OperationType.Create, FaultInjectionOperationType.CREATE_ITEM, FaultInjectionServerErrorType.INTERNAL_SERVER_ERROR, false, 500, 0 },
{ OperationType.Create, FaultInjectionOperationType.CREATE_ITEM, FaultInjectionServerErrorType.RETRY_WITH, true, 449, 0 },
{ OperationType.Create, FaultInjectionOperationType.CREATE_ITEM, FaultInjectionServerErrorType.TOO_MANY_REQUEST, true, 429, 0 },
{ OperationType.Create, FaultInjectionOperationType.CREATE_ITEM, FaultInjectionServerErrorType.TOO_MANY_REQUEST, true, 429, HttpConstants.SubStatusCodes.USER_REQUEST_RATE_TOO_LARGE },
{ OperationType.Create, FaultInjectionOperationType.CREATE_ITEM, FaultInjectionServerErrorType.TIMEOUT, false, 410, HttpConstants.SubStatusCodes.SERVER_GENERATED_408 }, // for server return 408, SDK will wrap into 410/21010
{ OperationType.Create, FaultInjectionOperationType.CREATE_ITEM, FaultInjectionServerErrorType.PARTITION_IS_MIGRATING, true, 410, 1008 },
{ OperationType.Create, FaultInjectionOperationType.CREATE_ITEM, FaultInjectionServerErrorType.PARTITION_IS_SPLITTING, true, 410, 1007 },
Expand Down Expand Up @@ -220,7 +220,7 @@ public void faultInjectionServerErrorRuleTests_OperationType(OperationType opera
cosmosDiagnostics,
operationType,
HttpConstants.StatusCodes.TOO_MANY_REQUESTS,
HttpConstants.SubStatusCodes.UNKNOWN,
HttpConstants.SubStatusCodes.USER_REQUEST_RATE_TOO_LARGE,
tooManyRequestsRuleId,
true);
} else {
Expand Down Expand Up @@ -494,7 +494,7 @@ public void faultInjectionServerErrorRuleTests_Partition() throws JsonProcessing
cosmosDiagnostics,
OperationType.Read,
HttpConstants.StatusCodes.TOO_MANY_REQUESTS,
HttpConstants.SubStatusCodes.UNKNOWN,
HttpConstants.SubStatusCodes.USER_REQUEST_RATE_TOO_LARGE,
feedRangeRuleId,
true
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public static Object[][] faultInjectionServerErrorResponseProvider() {
// faultInjectionServerError, will SDK retry, errorStatusCode, errorSubStatusCode
{ FaultInjectionServerErrorType.INTERNAL_SERVER_ERROR, false, 500, 0 },
{ FaultInjectionServerErrorType.RETRY_WITH, false, 449, 0 },
{ FaultInjectionServerErrorType.TOO_MANY_REQUEST, true, 429, 0 },
{ FaultInjectionServerErrorType.TOO_MANY_REQUEST, true, 429, HttpConstants.SubStatusCodes.USER_REQUEST_RATE_TOO_LARGE },
{ FaultInjectionServerErrorType.READ_SESSION_NOT_AVAILABLE, true, 404, 1002 },
{ FaultInjectionServerErrorType.SERVICE_UNAVAILABLE, false, 503, 21008 }
};
Expand Down Expand Up @@ -283,7 +283,7 @@ public void faultInjectionServerErrorRuleTests_Partition() throws JsonProcessing
cosmosDiagnostics,
OperationType.Read,
HttpConstants.StatusCodes.TOO_MANY_REQUESTS,
HttpConstants.SubStatusCodes.UNKNOWN,
HttpConstants.SubStatusCodes.USER_REQUEST_RATE_TOO_LARGE,
feedRangeRuleId,
true
);
Expand Down Expand Up @@ -504,7 +504,7 @@ public void faultInjectionServerErrorRuleTests_HitLimit(
cosmosDiagnostics,
operationType,
HttpConstants.StatusCodes.TOO_MANY_REQUESTS,
HttpConstants.SubStatusCodes.UNKNOWN,
HttpConstants.SubStatusCodes.USER_REQUEST_RATE_TOO_LARGE,
hitLimitRuleId,
true
);
Expand Down
Loading
Loading