Skip to content
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) #625

Merged
merged 1 commit into from
Jun 30, 2022

Conversation

ti-srebot
Copy link
Collaborator

@ti-srebot ti-srebot commented Jun 30, 2022

cherry-pick #624 to release-3.3
You can switch your code base to this Pull Request by using git-extras:

# In client-java repo:
git pr https://github.com/tikv/client-java/pull/625

After apply modifications, you can push your change to this PR via:

git push git@github.com:ti-srebot/client-java.git pr/625:release-3.3-5a757d95e527

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:

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)

Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
@ti-srebot
Copy link
Collaborator Author

/run-all-tests

@ti-srebot
Copy link
Collaborator Author

@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.

@codecov
Copy link

codecov bot commented Jun 30, 2022

Codecov Report

❗ No coverage uploaded for pull request base (release-3.3@7e8bdb0). Click here to learn what that means.
The diff coverage is n/a.

@@              Coverage Diff               @@
##             release-3.3     #625   +/-   ##
==============================================
  Coverage               ?   34.67%           
  Complexity             ?     1423           
==============================================
  Files                  ?      278           
  Lines                  ?    17358           
  Branches               ?     1972           
==============================================
  Hits                   ?     6019           
  Misses                 ?    10736           
  Partials               ?      603           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7e8bdb0...8df6a3c. Read the comment docs.

Copy link
Member

@iosmanthus iosmanthus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@iosmanthus iosmanthus merged commit 52491a1 into tikv:release-3.3 Jun 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants