Fixed a bug that caused sortedRanges exception #835
Merged
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
There was a bug where the SDK could not handle collisions in the effective partition key. Normally this is pretty much impossible, since the epk is 128, but in HashV1 we only hash the first 100 bytes. This means any two strings with the same large prefix will collide. This collision caused an assertion error (the query ranges were not sorted and non-overlapping (because there was a perfect overlap)).
The client side solution was to push the invariant into the structure instead of the check. The client now puts all the ranges into a sorted set to avoid this issue. In future this work should be pushed to the backend.
Fix is ported from internal PR: https://msdata.visualstudio.com/DefaultCollection/CosmosDB/_git/CosmosDB/pullrequest/248585
Type of change
Please delete options that are not relevant.
Closing issues
closes #833