-
Notifications
You must be signed in to change notification settings - Fork 110
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
[fix #623] region may be missed #624
Conversation
@iosmanthus PTAL |
Signed-off-by: TrafalgarRicardoLu <[email protected]>
c45aec6
to
e3559f6
Compare
Codecov Report
@@ Coverage Diff @@
## master #624 +/- ##
============================================
- Coverage 34.76% 34.73% -0.03%
- Complexity 1421 1424 +3
============================================
Files 278 278
Lines 17356 17358 +2
Branches 1972 1972
============================================
- Hits 6034 6030 -4
- Misses 10713 10718 +5
- Partials 609 610 +1
Continue to review full report at Codecov.
|
BackOffer backOffer = ConcreteBackOffer.newScannerNextMaxBackOff(); | ||
currentCache = client.scan(backOffer, startKey, version); | ||
region = client.getRegion(); |
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.
We might add some comments about this update since the scan
has some implicit side effects. In addition, this issue might occur in
client-java/src/main/java/org/tikv/common/operation/iterator/RawScanIterator.java
Line 49 in 9ce52d3
TiRegion loadCurrentRegionToCache() throws GrpcException { |
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.
I have add comment and fix it in RawScanIterator. I think test it is not easy, so a TODO is added.
Signed-off-by: TrafalgarRicardoLu <[email protected]>
Signed-off-by: TrafalgarRicardoLu <[email protected]>
Signed-off-by: TrafalgarRicardoLu <[email protected]>
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.
LGTM
Signed-off-by: TrafalgarRicardoLu <[email protected]>
@zhangyangyu, Thanks for your review. The bot only counts LGTMs from Reviewers and higher roles, but you're still welcome to leave your comments. You are not a reviewer or committer or co-leader or leader. |
Thanks for your contribution! Could you please add test code to pass the code coverage check, thanks. |
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.
LGTM
We may add some mock tests in the next pull request. |
Signed-off-by: ti-srebot <[email protected]>
cherry pick to release-3.3 in PR #625 |
Co-authored-by: Trafalgar Ricardo Lu <[email protected]>
What problem does this PR solve?
Issue Number: close #623
Problem Description: If there is a region split between two queries, it may miss some regions.
What is changed and how does it work?
I change the time of getting region from before scan to after scan.
When we build client, we will use region info in regionCache. After region split, it's outdated.
But when client try to scan the region, it will get the newest region info from pb.
In the original code, we get region info before scan. So the region info is still outdated and it will use the old endKey to get next region. Using the old endKey may miss some regions that split during the two query.
I get the region info after scan to make sure the return value is newest.
Check List for Tests
This PR has been tested by at least one of the following methods: