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

tikv: invalidate store's regions when store be removed in kv #11567

Merged
merged 2 commits into from
Aug 2, 2019
Merged

tikv: invalidate store's regions when store be removed in kv #11567

merged 2 commits into from
Aug 2, 2019

Conversation

lysu
Copy link
Contributor

@lysu lysu commented Aug 1, 2019

What problem does this PR solve?

this question can be reproduced by TestReplaceAddrWithNewStore testcase:

  1. access A store using region1, then region1 will be put into region-cache
  2. remove A store(store_id=1) in ip1:port2 from kv-cluster
  3. then add B store(store_id=2) in the same ip1:port2 into kv-cluster
  4. access region1 again via region cache(make sure TTL isn't expired)

make sure 2-3 no any request hit region1, then 4 will be fail in infline loop

the root reason is: region-cache will try async fetch store A's new address but got nil, region request will keep retry and wait "new addr", this also will make cache TTL have no chance to invalidate cached info.

What is changed and how it works?

invalidate regions in removed store, to let request have the chance to reload new region's store info from pd.

after this modification, TestReplaceAddrWithNewStore can works

Check List

Tests

  • Unit test

Code changes

  • invalidate code

Side effects

  • N/A

Related changes

  • Need to cherry-pick to the release 3.0

This change is Reviewable

@lysu lysu added type/bugfix This PR fixes a bug. priority/release-blocker This issue blocks a release. Please solve it ASAP. needs-cherry-pick-3.0 labels Aug 1, 2019
@lysu
Copy link
Contributor Author

lysu commented Aug 1, 2019

/run-all-tests

@lysu
Copy link
Contributor Author

lysu commented Aug 1, 2019

/run-unit-test

@codecov
Copy link

codecov bot commented Aug 1, 2019

Codecov Report

Merging #11567 into master will decrease coverage by 0.2811%.
The diff coverage is 100%.

@@               Coverage Diff                @@
##             master     #11567        +/-   ##
================================================
- Coverage   81.4916%   81.2105%   -0.2812%     
================================================
  Files           427        426         -1     
  Lines         93196      91828      -1368     
================================================
- Hits          75947      74574      -1373     
- Misses        11862      11889        +27     
+ Partials       5387       5365        -22

@lysu lysu requested a review from jackysp August 2, 2019 05:09
@lysu
Copy link
Contributor Author

lysu commented Aug 2, 2019

@coocood @tiancaiamao PTAL thx

@coocood
Copy link
Member

coocood commented Aug 2, 2019

LGTM

Copy link
Member

@jackysp jackysp left a comment

Choose a reason for hiding this comment

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

LGTM

@jackysp jackysp added status/all tests passed status/can-merge Indicates a PR has been approved by a committer. labels Aug 2, 2019
@sre-bot
Copy link
Contributor

sre-bot commented Aug 2, 2019

/run-all-tests

@sre-bot sre-bot merged commit b493fb6 into pingcap:master Aug 2, 2019
@sre-bot
Copy link
Contributor

sre-bot commented Aug 2, 2019

cherry pick to release-3.0 failed

@dikang123
Copy link

dikang123 commented Aug 8, 2019

Does this issue affect tidb v2.1.15?

@lysu
Copy link
Contributor Author

lysu commented Aug 8, 2019

@dikang123 no, this issue only affect v3.0.0 and v3.0.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/tikv priority/release-blocker This issue blocks a release. Please solve it ASAP. status/can-merge Indicates a PR has been approved by a committer. type/bugfix This PR fixes a bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants