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

cluster: support evict leaders on stop and restore on start #1789

Merged
merged 2 commits into from
Mar 14, 2022

Conversation

AstroProfundis
Copy link
Contributor

@AstroProfundis AstroProfundis commented Mar 10, 2022

What problem does this PR solve?

Close #1781

What is changed and how it works?

  • Add a hidden --evict-leaders argument to tiup-cluster stop command, to evict store leaders from an instance and wait it to complete, ignored for non-store instances. Only use it with -N argument to stop specific instance, if there is no place for store leaders to transfer, the operation may fail.
  • Add a hidden --restore-leaders argument to tiup-cluster start command, to delete the store leader evict scheduler of an instance, so that leaders are allowed to transfer back to it. If the instance was stopped with --evict-leaders and started without --restore-leaders, the instance will be up but no leader could be transferred to it, in that case, run start again with --restore-leaders or use pd-ctl to delete the store leader evict scheduler.

Also comment some unused code in pkg/cluster/task/action.go, we're calling those functions direct in manager, not via a task, maybe we need to also refactor those part later to make things easier.

Check List

Tests

  • Manual test (add detailed scripts or steps below)

Code changes

  • Has exported function/method change

Side effects

  • Increased code complexity

@AstroProfundis AstroProfundis self-assigned this Mar 10, 2022
@ti-chi-bot
Copy link
Member

ti-chi-bot commented Mar 10, 2022

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • srstack

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 do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Mar 10, 2022
@ti-chi-bot ti-chi-bot requested a review from breezewish March 10, 2022 08:45
@ti-chi-bot ti-chi-bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Mar 10, 2022
@codecov-commenter
Copy link

codecov-commenter commented Mar 10, 2022

Codecov Report

Merging #1789 (6e48a8e) into master (5b18753) will decrease coverage by 5.90%.
The diff coverage is 62.14%.

❗ Current head 6e48a8e differs from pull request most recent head 836dcda. Consider uploading reports for the commit 836dcda to get more accurate results

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1789      +/-   ##
==========================================
- Coverage   53.08%   47.18%   -5.90%     
==========================================
  Files         303      303              
  Lines       34587    34829     +242     
==========================================
- Hits        18358    16431    -1927     
- Misses      14077    16436    +2359     
+ Partials     2152     1962     -190     
Flag Coverage Δ
cluster 32.09% <60.24%> (-9.24%) ⬇️
dm 24.83% <53.75%> (+0.01%) ⬆️
playground 24.95% <0.00%> (+12.33%) ⬆️
tiup 14.40% <ø> (-0.02%) ⬇️
unittest 21.30% <23.08%> (+0.01%) ⬆️

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

Impacted Files Coverage Δ
components/cluster/command/audit.go 41.38% <ø> (-18.00%) ⬇️
components/dm/command/audit.go 62.07% <ø> (+2.69%) ⬆️
pkg/cluster/audit/audit.go 37.81% <ø> (-1.03%) ⬇️
pkg/cluster/manager/cleanup.go 0.00% <0.00%> (-57.92%) ⬇️
pkg/cluster/operation/operation.go 74.19% <ø> (-6.45%) ⬇️
pkg/cluster/task/action.go 46.30% <0.00%> (-9.26%) ⬇️
pkg/cluster/operation/action.go 60.69% <39.39%> (-4.25%) ⬇️
pkg/cluster/manager/basic.go 48.29% <44.44%> (-6.30%) ⬇️
components/cluster/command/stop.go 52.00% <83.33%> (-18.00%) ⬇️
components/dm/command/scale_in.go 60.71% <88.89%> (+1.31%) ⬆️
... and 92 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 5b18753...836dcda. Read the comment docs.

@AstroProfundis AstroProfundis force-pushed the evict-on-stop branch 2 times, most recently from 3750ec7 to 81a5e7c Compare March 10, 2022 09:49
@AstroProfundis AstroProfundis requested review from nexustar and srstack and removed request for breezewish March 11, 2022 03:00
@AstroProfundis AstroProfundis marked this pull request as ready for review March 11, 2022 03:00
@ti-chi-bot ti-chi-bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Mar 11, 2022
@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Mar 14, 2022
@AstroProfundis
Copy link
Contributor Author

/merge

@ti-chi-bot
Copy link
Member

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

Commit hash: 836dcda

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Mar 14, 2022
@ti-chi-bot ti-chi-bot merged commit b736fb4 into pingcap:master Mar 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/L Denotes a PR that changes 100-499 lines, ignoring generated files. status/can-merge Indicates a PR has been approved by a committer. status/LGT1 Indicates that a PR has LGTM 1.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

When stopping pd or tikv, add transfer leader argument
4 participants