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

server/core: check region term before updating cache (#2667) #2672

Merged
merged 2 commits into from
Jul 27, 2020

Conversation

ti-srebot
Copy link
Contributor

cherry-pick #2667 to release-4.0


Signed-off-by: howardlau1999 [email protected]

What problem does this PR solve?

Close #2657

What is changed and how it works?

Collect the term field in the heartbeat message into RegionInfo and check if the term is greater than the one in cache to avoid invalid cache updates.

Check List

Tests

  • Unit test

Code changes

  • Has PreCheckPutRegion changed
  • Add field term in struct RegionInfo

Release note

Avoid invalid cache updates after the leader of a region has changed.

@ti-srebot ti-srebot added contribution This PR is from a community contributor. status/LGT2 Indicates that a PR has LGTM 2. type/cherry-pick labels Jul 22, 2020
@ti-srebot ti-srebot added this to the v4.0.4 milestone Jul 22, 2020
@ti-srebot ti-srebot self-assigned this Jul 22, 2020
Copy link
Member

@JmPotato JmPotato left a comment

Choose a reason for hiding this comment

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

LGTM

@ti-srebot
Copy link
Contributor Author

@JmPotato,Thanks for your review. However, LGTM is restricted to Reviewers or higher roles.See the corresponding SIG page for more information. Related SIGs: scheduling(slack).

@codecov-commenter
Copy link

codecov-commenter commented Jul 22, 2020

Codecov Report

Merging #2672 into release-4.0 will decrease coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@               Coverage Diff               @@
##           release-4.0    #2672      +/-   ##
===============================================
- Coverage        77.17%   77.16%   -0.01%     
===============================================
  Files              205      205              
  Lines            22232    22237       +5     
===============================================
+ Hits             17157    17159       +2     
- Misses            3768     3771       +3     
  Partials          1307     1307              
Impacted Files Coverage Δ
server/core/basic_cluster.go 91.37% <100.00%> (+1.06%) ⬆️
server/core/region.go 91.46% <100.00%> (+0.06%) ⬆️
server/tso/tso.go 78.94% <0.00%> (-1.98%) ⬇️
server/grpc_service.go 59.07% <0.00%> (-1.16%) ⬇️
server/cluster/cluster.go 80.84% <0.00%> (-0.32%) ⬇️
client/base_client.go 91.27% <0.00%> (+0.67%) ⬆️
server/server.go 76.52% <0.00%> (+0.74%) ⬆️
pkg/mock/mockhbstream/mockhbstream.go 90.76% <0.00%> (+1.53%) ⬆️

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 2f2447a...f43e49e. Read the comment docs.

Copy link
Member

@rleungx rleungx left a comment

Choose a reason for hiding this comment

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

LGTM

@ti-srebot ti-srebot added status/LGT1 Indicates that a PR has LGTM 1. and removed status/LGT2 Indicates that a PR has LGTM 2. labels Jul 22, 2020
@ti-srebot ti-srebot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Jul 23, 2020
@rleungx
Copy link
Member

rleungx commented Jul 27, 2020

/merge

@ti-srebot
Copy link
Contributor Author

Your auto merge job has been accepted, waiting for:

  • 2669
  • 2678

@ti-srebot ti-srebot added the status/can-merge Indicates a PR has been approved by a committer. label Jul 27, 2020
@nolouch
Copy link
Contributor

nolouch commented Jul 27, 2020

/merge

@ti-srebot
Copy link
Contributor Author

Your auto merge job has been accepted, waiting for:

  • 2678

@nolouch
Copy link
Contributor

nolouch commented Jul 27, 2020

/merge

@ti-srebot
Copy link
Contributor Author

/run-all-tests

@ti-srebot ti-srebot merged commit 2786acc into tikv:release-4.0 Jul 27, 2020
@disksing disksing modified the milestones: v4.0.4, v4.0.5 Jul 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution This PR is from a community contributor. status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants