Skip to content

PCP: Support to pause a scheduler #1831#1942

Merged
sre-bot merged 19 commits intotikv:masterfrom
hrbeuyz24:feat-pause_scheduler
Nov 22, 2019
Merged

PCP: Support to pause a scheduler #1831#1942
sre-bot merged 19 commits intotikv:masterfrom
hrbeuyz24:feat-pause_scheduler

Conversation

@hrbeuyz24
Copy link
Contributor

@hrbeuyz24 hrbeuyz24 commented Nov 15, 2019

Which problem does this PR solve?

PCP #1831

What have you changed?

  • Add a fileld in scheduleController struct named DelayUntil which is the end timestamp that the scheduling should be blocked, add a func isPaused which return sheduler's state, when scheduler start a new work loop, it will judge scheduler whether is paused. Set DelayUntil 0 when resume a scheduler.
  • Add pd-ctl command like
    schedule pause <name><delay>
    schedule resume <name>

For example
schedule pause balance-region-scheduler 10
schedule pause all 10
schedule resume balance-region-scheduler
schedule resume all

  • It can pause all scheduler in once, or pause a specific scheduler for delay specific seconds.
  • Pause a paused scheduler will return error, resume a un-paused scheduler won't return error.

What are the type of the changes?

  • New feature : add pause and resume func in pd-ctl

How has this PR been tested?

manual test and unit test

@sre-bot
Copy link
Contributor

sre-bot commented Nov 15, 2019

Thanks for your contribution. If your PR get merged, you will be rewarded 0 points.

@CLAassistant
Copy link

CLAassistant commented Nov 15, 2019

CLA assistant check
All committers have signed the CLA.

@hrbeuyz24 hrbeuyz24 closed this Nov 15, 2019
@hrbeuyz24 hrbeuyz24 reopened this Nov 15, 2019
@shafreeck shafreeck self-requested a review November 15, 2019 09:15
Copy link
Contributor

@lhy1024 lhy1024 left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution. If your PR get merged, you will be rewarded 0 points.

why 0 points? It should be 100 points. Our rebot still silly.

Copy link
Contributor

@shafreeck shafreeck left a comment

Choose a reason for hiding this comment

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

Thanks a lot for your contribution, nice work!

It seems a little complex to use two channels. Maybe there are some simple solutions. For example: Add a field to a scheduler's configuration like DelayUntil which is the end timestamp that the scheduling should be blocked. Return false when calling AllowSchedule which checks the value of DelayUntil. Reset the value of DelayUntil to 0 when resuming a scheduler.

Feel free to have a discussion if you have better ideas.

@hrbeuyz24
Copy link
Contributor Author

Thanks a lot for your contribution, nice work!

It seems a little complex to use two channels. Maybe there are some simple solutions. For example: Add a field to a scheduler's configuration like DelayUntil which is the end timestamp that the scheduling should be blocked. Return false when calling AllowSchedule which checks the value of DelayUntil. Reset the value of DelayUntil to 0 when resuming a scheduler.

Feel free to have a discussion if you have better ideas.

Thanks for your reply! it seems that my idea is really complex, i will try your suggestion.

@hrbeuyz24
Copy link
Contributor Author

@lhy1024 @shafreeck please review the new commit.

@hrbeuyz24
Copy link
Contributor Author

/run-all-test

@rleungx
Copy link
Member

rleungx commented Nov 18, 2019

@hrbeuyz24 Thanks for your contribution! And would you mind adding some unit tests?

@shafreeck shafreeck added the priority/P0 The issue has P0 priority. label Nov 19, 2019
@hrbeuyz24
Copy link
Contributor Author

@rleungx @shafreeck @lhy1024
add some unit tests, make some changes according the previous review.

@hrbeuyz24
Copy link
Contributor Author

/run-al-test

@hrbeuyz24 hrbeuyz24 requested a review from shafreeck November 20, 2019 08:47
@hrbeuyz24 hrbeuyz24 requested a review from shafreeck November 20, 2019 11:39
@codecov-io
Copy link

codecov-io commented Nov 20, 2019

Codecov Report

Merging #1942 into master will decrease coverage by 0.08%.
The diff coverage is 56.47%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1942      +/-   ##
==========================================
- Coverage   77.84%   77.75%   -0.09%     
==========================================
  Files         171      171              
  Lines       17126    17210      +84     
==========================================
+ Hits        13332    13382      +50     
- Misses       2753     2779      +26     
- Partials     1041     1049       +8
Impacted Files Coverage Δ
server/api/router.go 99.09% <100%> (ø) ⬆️
server/api/scheduler.go 34.84% <38.46%> (+0.39%) ⬆️
server/handler.go 52.13% <38.88%> (-1.09%) ⬇️
tools/pd-ctl/pdctl/command/scheduler.go 70.29% <50%> (-1.83%) ⬇️
server/coordinator.go 84.85% <84%> (-0.13%) ⬇️
pkg/testutil/operator_check.go 88.88% <0%> (-11.12%) ⬇️
server/schedule/placement/rule.go 87.87% <0%> (-6.07%) ⬇️
pkg/etcdutil/etcdutil.go 78.26% <0%> (-4.35%) ⬇️
server/schedule/operator/step.go 75.88% <0%> (-2.13%) ⬇️
... and 8 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 c6d98e2...adaa367. Read the comment docs.

@hrbeuyz24 hrbeuyz24 requested a review from shafreeck November 20, 2019 13:17
@hrbeuyz24 hrbeuyz24 requested a review from shafreeck November 22, 2019 08:50
Copy link
Contributor

@shafreeck shafreeck left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks a lot for your contribution and This is pleasant cooperation.

Copy link
Contributor

@nolouch nolouch left a comment

Choose a reason for hiding this comment

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

reset LGTM.

@hrbeuyz24 hrbeuyz24 requested review from lhy1024 and nolouch November 22, 2019 14:31
@nolouch nolouch added the status/can-merge Indicates a PR has been approved by a committer. label Nov 22, 2019
@sre-bot
Copy link
Contributor

sre-bot commented Nov 22, 2019

/run-all-tests

@sre-bot sre-bot merged commit cdd258b into tikv:master Nov 22, 2019
@sre-bot
Copy link
Contributor

sre-bot commented Nov 22, 2019

Team Trash Brother complete task #1831 and get 100 score, currerent score 100

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority/P0 The issue has P0 priority. 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.

8 participants