Skip to content

Internal: Fixed exception handling around GoneException and RequestTimeoutException#15735

Merged
FabianMeiswinkel merged 19 commits intoAzure:masterfrom
FabianMeiswinkel:users/fabianm/GoneAndRequestTimeoutExceptionHandling
Oct 2, 2020
Merged

Internal: Fixed exception handling around GoneException and RequestTimeoutException#15735
FabianMeiswinkel merged 19 commits intoAzure:masterfrom
FabianMeiswinkel:users/fabianm/GoneAndRequestTimeoutExceptionHandling

Conversation

@FabianMeiswinkel
Copy link
Member

Fixing a couple of issues with the exception handling in the availability stack:

  • Write-requests which have been sent to the service should not be retried when they fail with GoneException
  • Read-requests resulting in Request timeouts (when the time between sending the request and waiting for response extends the request timeout duration or service returns 408) should be retried
  • Admission control incorrectly was throwing a RequestTimeoutException -should have been a GoneException instead

Closes #15363
Closes #15305
Closes #15304

@FabianMeiswinkel
Copy link
Member Author

Looking into options to add some additional test coverage (for admission control and the request timeout exception to gone exception mapping)

@moderakh moderakh self-requested a review September 28, 2020 17:22
Copy link
Contributor

@moderakh moderakh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

address refresh is done as part of the retry.

If no one retries who is going to refresh the address caches when request.requestContext.forceRefreshAddressCache set to true?

@FabianMeiswinkel
Copy link
Member Author

/azp run java - cosmos - tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@FabianMeiswinkel
Copy link
Member Author

/azp run java - cosmos - tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

…into users/fabianm/GoneAndRequestTimeoutExceptionHandling
@FabianMeiswinkel
Copy link
Member Author

/azp run java - cosmos - tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@FabianMeiswinkel
Copy link
Member Author

/azp run java - cosmos - tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@moderakh
Copy link
Contributor

/azp run java - cosmos - tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

…into users/fabianm/GoneAndRequestTimeoutExceptionHandling
Copy link
Contributor

@moderakh moderakh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you don't need to wait on address refresh cache when write request result in gone.

you could instead trigger an address cache refresh in background and return the write response immediately.

See this as example:
https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/directconnectivity/ConsistencyWriter.java#L365-L373

shouldRetryResult.policyArg.getValue0() != null &&
shouldRetryResult.policyArg.getValue0()) {

return addressSelector.resolveAddressesAsync(
Copy link
Contributor

@moderakh moderakh Sep 30, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is for refreshing address cache on a Gone Exception for write request.

With this approach the write response will get blocked till the unrelated address resolution completes.

you could instead trigger an address cache refresh in background and return the write response immediately.

See this as example:
https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/directconnectivity/ConsistencyWriter.java#L365-L373

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed - good catch. Thanks!

@moderakh moderakh self-requested a review September 30, 2020 20:44
Copy link
Contributor

@moderakh moderakh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@FabianMeiswinkel
Copy link
Member Author

/azp run java - cosmos - tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Member

@kushagraThapar kushagraThapar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good to me, some minor suggestions and one blocking comment to add Microsoft copyright header to the new file.

Copy link
Member

@kushagraThapar kushagraThapar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @FabianMeiswinkel looks good to me.

@FabianMeiswinkel
Copy link
Member Author

/azp run java - cosmos - tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@FabianMeiswinkel
Copy link
Member Author

/check-enforcer evaluate

@FabianMeiswinkel
Copy link
Member Author

/azp run java - cosmos - tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@FabianMeiswinkel FabianMeiswinkel merged commit 187d9e9 into Azure:master Oct 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

5 participants