util/ranger: fix incorrect behavior about index who has prefix column #8851
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.
What problem does this PR solve?
Previously, when one index has a prefix column, we'll convert an open interval to a closed one. e.g.
col < aaaaaa and col > aaaaaa
will become(-inf, aaa], [aaa, +inf)
(if the prefix len is 3).However when sending requests to tikv. We need to promise that the ranges need to be ordered and no intersection. In
(-inf, aaa], [aaa, +inf)
,[aaa, aaa]
is intersected in both interval, it will cause error arose whenaaa
is the exact the place that that data before and after it lies in different regions.What is changed and how it works?
Enhance the check, only we'll change the interval only when the last index column is cut.
Do a range merging if a cut is performed.
Check List
Tests
Side effects
Related changes
fix the range information built from index who has prefix column, it may cause tikv panic in a very rare situation
This change is