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

checker: fix rule checker panic #2160

Merged
merged 1 commit into from
Feb 26, 2020
Merged

checker: fix rule checker panic #2160

merged 1 commit into from
Feb 26, 2020

Conversation

disksing
Copy link
Contributor

Signed-off-by: disksing [email protected]

What problem does this PR solve?

when no more store to replace, it panics:

[2020/02/26 11:46:45.244 +08:00] [FATAL] [log.go:294] [panic] [recover="\"invalid memory address or nil pointer dereference\""] [stack="github.com/pingcap/log.Fatal\n\t/home/birdstorm/go/pkg/mod/github.com/pingcap/[email protected]      7041106-d28c14d3b1cd/global.go:59\ngithub.com/pingcap/pd/v3/pkg/logutil.LogPanic\n\t/home/birdstorm/go/src/github.com/pingcap/pd/pkg/logutil/log.go:294\nruntime.gopanic\n\t/usr/local/go/src/runtime/panic.go:679\nruntime.panicmem\n\t      /usr/local/go/src/runtime/panic.go:199\nruntime.sigpanic\n\t/usr/local/go/src/runtime/signal_unix.go:394\ngithub.com/pingcap/kvproto/pkg/metapb.(*Store).GetId\n\t/home/birdstorm/go/pkg/mod/github.com/pingcap/[email protected]      74014-83e827908584/pkg/metapb/metapb.pb.go:221\ngithub.com/pingcap/pd/v3/server/core.DistinctScore\n\t/home/birdstorm/go/src/github.com/pingcap/pd/server/core/store.go:453\ngithub.com/pingcap/pd/v3/server/schedule/checker.(*RuleChec      ker).fixBetterLocation\n\t/home/birdstorm/go/src/github.com/pingcap/pd/server/schedule/checker/rule_checker.go:187\ngithub.com/pingcap/pd/v3/server/schedule/checker.(*RuleChecker).fixRulePeer\n\t/home/birdstorm/go/src/github.com/pin      gcap/pd/server/schedule/checker/rule_checker.go:110\ngithub.com/pingcap/pd/v3/server/schedule/checker.(*RuleChecker).Check\n\t/home/birdstorm/go/src/github.com/pingcap/pd/server/schedule/checker/rule_checker.go:59\ngithub.com/pingca      p/pd/v3/server/schedule.(*CheckerController).CheckRegion\n\t/home/birdstorm/go/src/github.com/pingcap/pd/server/schedule/checker_controller.go:58\ngithub.com/pingcap/pd/v3/server/cluster.(*coordinator).patrolRegions\n\t/home/birdsto      rm/go/src/github.com/pingcap/pd/server/cluster/coordinator.go:125"]

What is changed and how it works?

  • check nil
  • add unit test

Check List

Tests

  • Unit test

Related changes

  • Need to cherry-pick to the release branch (release-3.1)

@disksing disksing added the component/schedule Scheduling logic. label Feb 26, 2020
@disksing disksing added this to the v4.0.0-rc milestone Feb 26, 2020
@codecov-io
Copy link

Codecov Report

Merging #2160 into master will increase coverage by 0.06%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2160      +/-   ##
==========================================
+ Coverage   76.06%   76.12%   +0.06%     
==========================================
  Files         195      195              
  Lines       20577    20580       +3     
==========================================
+ Hits        15651    15667      +16     
+ Misses       3733     3724       -9     
+ Partials     1193     1189       -4
Impacted Files Coverage Δ
server/schedule/checker/rule_checker.go 76.07% <100%> (+0.44%) ⬆️
pkg/etcdutil/etcdutil.go 82.6% <0%> (-8.7%) ⬇️
server/region_syncer/client.go 81.03% <0%> (-3.45%) ⬇️
server/tso/tso.go 77.37% <0%> (-2.92%) ⬇️
server/member/leader.go 73.1% <0%> (-1.69%) ⬇️
server/server.go 79.39% <0%> (+0.27%) ⬆️
server/grpc_service.go 57.08% <0%> (+0.42%) ⬆️
server/handler.go 51.61% <0%> (+0.43%) ⬆️
server/config/option.go 90.04% <0%> (+0.86%) ⬆️
server/core/storage.go 73.86% <0%> (+1%) ⬆️
... and 4 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 c8589fc...c57da48. 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

@disksing disksing added the needs-cherry-pick-release-3.1 The PR needs to cherry pick to release-3.1 branch. label Feb 26, 2020
@disksing
Copy link
Contributor Author

/merge

@sre-bot sre-bot added the status/can-merge Indicates a PR has been approved by a committer. label Feb 26, 2020
@sre-bot
Copy link
Contributor

sre-bot commented Feb 26, 2020

/run-all-tests

@sre-bot sre-bot merged commit 8810ba5 into tikv:master Feb 26, 2020
@sre-bot
Copy link
Contributor

sre-bot commented Feb 26, 2020

cherry pick to release-3.1 in PR #2161

@disksing disksing deleted the rule-panic branch February 26, 2020 10:20
sre-bot added a commit that referenced this pull request Feb 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/schedule Scheduling logic. needs-cherry-pick-release-3.1 The PR needs to cherry pick to release-3.1 branch. status/can-merge Indicates a PR has been approved by a committer.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants