Skip to content

Commit

Permalink
server: fix the valid scheduler was deleted when start coordinator (#…
Browse files Browse the repository at this point in the history
…1045)

* server: fix the valid scheduler was deleted when start coordinator
  • Loading branch information
nolouch authored May 4, 2018
1 parent aa811bf commit a288840
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
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.Info("skip create ", schedulerCfg.Type)
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

0 comments on commit a288840

Please sign in to comment.