FeedRanges: Fixes GetFeedRangesAsync throwing DocumentClientException #4640
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pull Request Template
Description
Container.GetFeedRangesAsync
performs a read on PartitionKeyRanges leveraging thePartititonKeyRangeCache
. This translates into an HTTP operation to Gateway.In cases where Gateway returns a failure (see linked issue), the
GatewayStoreClient
will fail creating aDocumentClientException
.In normal circumstances,
PartitionKeyRangeCache
is used within the scope of the Handler pipeline, on which anyDocumentClientException
is converted toCosmosException
, but because this is a direct invocation, there is nothing doing the conversion andDocumentClientException
ends up being thrown to the user.Solution
The proposed solution applies the conversion at the method level (
GetFeedRangesAsync
) to ensure theDocumentClientException
is not received by the user.An alternative that was evaluated was to apply the conversion within the
PartitionKeyRangeCache
but the problem is that this component is used within other components (such as the Direct Transport stack) where there are already contracts in-place that would expectDocumentClientException
. Breaking this contract would be dangerous.Type of change
Please delete options that are not relevant.
Closing issues
Closes #4528