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.
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
region cache: check if the pd returned regions covers the ranges #1377
region cache: check if the pd returned regions covers the ranges #1377
Changes from all commits
d7d994c
ac636f8
8f9515c
36f7d6f
81f2a7c
6f07898
a1ced8d
ca52cb7
6a0d73e
f6688eb
3339583
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not very familiar with the usage of it. Is the ranges here guaranteed to be already sorted by their start key?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the input ranges are sorted and cannot be overlapped.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible the end key of the last region is also empty, should the
true
be returned in this case?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is theelse
branch ofif len(checkKey) == 0
, so here thecheckKey
is not empty, meaning that the returned regions didn't cover up to the very end.Wait,
checkKey
looks never be assigned with an empty end_key as the function would immediately return at line 2257. The only possibility that it's empty must be an empty start_key which comes from the first range to check.Then does it work when the ranges to check is
["", "b")
and the regions is["", "a")
?cc @you06
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, sorry, it still looks fine.
But I suggest adding some test cases where there are only one requested range and only one region in the result, and the range is half unbounded (empty startKey + non-empty endKey and non-empty startKey + empty endKey).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Half unbounded cases added.