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

election: fix the panic bug of lease #4061

Merged
merged 1 commit into from
Sep 1, 2021

Conversation

JmPotato
Copy link
Member

@JmPotato JmPotato commented Sep 1, 2021

Signed-off-by: JmPotato ghzpotato@gmail.com

What problem does this PR solve?

#4044 makes (*Leadership).Reset() will set its lease to nil, which will cause panic due to the nil pointer when we call some methods of the lease.

What is changed and how it works?

Check lease itself before we deref it.

Check List

Tests

  • Unit test
  • Integration test

Release note

None.

Signed-off-by: JmPotato <ghzpotato@gmail.com>
@JmPotato JmPotato added type/bugfix This PR fixes a bug. require-LGT1 Indicates that the PR requires an LGTM. component/election Election related logic. labels Sep 1, 2021
@JmPotato JmPotato requested a review from Yisaer September 1, 2021 07:10
@ti-chi-bot
Copy link
Member

ti-chi-bot commented Sep 1, 2021

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • Yisaer

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

The full list of commands accepted by this bot can be found here.

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot ti-chi-bot added the release-note-none Denotes a PR that doesn't merit a release note. label Sep 1, 2021
@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Sep 1, 2021
@JmPotato
Copy link
Member Author

JmPotato commented Sep 1, 2021

/merge

@ti-chi-bot
Copy link
Member

@JmPotato: It seems you want to merge this PR, I will help you trigger all the tests:

/run-all-tests

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository.

@ti-chi-bot
Copy link
Member

This pull request has been accepted and is ready to merge.

Commit hash: 9527f1f

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Sep 1, 2021
@disksing
Copy link
Contributor

disksing commented Sep 1, 2021

/merge

@ti-chi-bot
Copy link
Member

@disksing: It seems you want to merge this PR, I will help you trigger all the tests:

/run-all-tests

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository.

@codecov
Copy link

codecov bot commented Sep 1, 2021

Codecov Report

Merging #4061 (9527f1f) into master (9d066b6) will decrease coverage by 0.04%.
The diff coverage is 82.22%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #4061      +/-   ##
==========================================
- Coverage   74.64%   74.59%   -0.05%     
==========================================
  Files         257      258       +1     
  Lines       25972    26059      +87     
==========================================
+ Hits        19388    19440      +52     
- Misses       4859     4886      +27     
- Partials     1725     1733       +8     
Flag Coverage Δ
unittests 74.59% <82.22%> (-0.05%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
server/election/lease.go 84.12% <0.00%> (-5.71%) ⬇️
server/core/store.go 78.27% <14.28%> (-1.73%) ⬇️
server/schedule/placement/fit.go 86.06% <62.50%> (-1.87%) ⬇️
server/schedule/placement/region_rule_cache.go 93.87% <93.87%> (ø)
server/schedule/checker/rule_checker.go 80.57% <100.00%> (+0.11%) ⬆️
server/schedule/placement/rule.go 96.22% <100.00%> (+0.07%) ⬆️
server/schedule/placement/rule_manager.go 84.61% <100.00%> (+1.48%) ⬆️
pkg/tempurl/tempurl.go 45.00% <0.00%> (-15.00%) ⬇️
server/schedule/placement/label_constraint.go 86.36% <0.00%> (-9.10%) ⬇️
server/tso/local_allocator.go 71.62% <0.00%> (-6.76%) ⬇️
... and 16 more

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 08a37f7...9527f1f. Read the comment docs.

@ti-chi-bot ti-chi-bot merged commit a1b5042 into tikv:master Sep 1, 2021
@JmPotato JmPotato deleted the fix_election_panic branch September 1, 2021 07:50
@nolouch nolouch mentioned this pull request Sep 26, 2021
5 tasks
v01dstar pushed a commit to v01dstar/pd that referenced this pull request Oct 28, 2021
Signed-off-by: JmPotato <ghzpotato@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/election Election related logic. release-note-none Denotes a PR that doesn't merit a release note. require-LGT1 Indicates that the PR requires an LGTM. status/can-merge Indicates a PR has been approved by a committer. status/LGT1 Indicates that a PR has LGTM 1. type/bugfix This PR fixes a bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants