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: fix the valid scheduler was deleted when start coordinator #1045

Merged
merged 4 commits into from
May 4, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions server/coordinator.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,9 @@ func (c *coordinator) run() {
scheduleCfg := c.cluster.opt.load()
for _, schedulerCfg := range scheduleCfg.Schedulers {
if schedulerCfg.Disable {
scheduleCfg.Schedulers[k] = schedulerCfg
k++
log.Warning("skip create ", schedulerCfg.Type)
Copy link
Member

@Connor1996 Connor1996 May 3, 2018

Choose a reason for hiding this comment

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

I don't think it should be in warning level

continue
}
s, err := schedule.CreateScheduler(schedulerCfg.Type, c.limiter, schedulerCfg.Args...)
Expand Down
8 changes: 8 additions & 0 deletions server/coordinator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,14 @@ func (s *testCoordinatorSuite) TestPersistScheduler(c *C) {
c.Assert(newOpt.GetSchedulers(), HasLen, 7)
tc.clusterInfo.opt = newOpt

co = newCoordinator(tc.clusterInfo, hbStreams, namespace.DefaultClassifier)
co.run()
c.Assert(co.schedulers, HasLen, 3)
co.stop()
// suppose restart PD again
_, newOpt = newTestScheduleConfig()
newOpt.reload(tc.kv)
tc.clusterInfo.opt = newOpt
co = newCoordinator(tc.clusterInfo, hbStreams, namespace.DefaultClassifier)
co.run()
c.Assert(co.schedulers, HasLen, 3)
Expand Down