diff --git a/pkg/schedule/config/config.go b/pkg/schedule/config/config.go index c8fa62b8aff..3b1557d6a48 100644 --- a/pkg/schedule/config/config.go +++ b/pkg/schedule/config/config.go @@ -525,9 +525,7 @@ type SchedulerConfig struct { var DefaultSchedulers = SchedulerConfigs{ {Type: "balance-region"}, {Type: "balance-leader"}, - {Type: "balance-witness"}, {Type: "hot-region"}, - {Type: "transfer-witness-leader"}, } // IsDefaultScheduler checks whether the scheduler is enable by default. diff --git a/server/cluster/cluster_test.go b/server/cluster/cluster_test.go index d1c8c8fe9cb..e84f880a50a 100644 --- a/server/cluster/cluster_test.go +++ b/server/cluster/cluster_test.go @@ -3041,8 +3041,6 @@ func TestAddScheduler(t *testing.T) { re.NoError(controller.RemoveScheduler(schedulers.BalanceLeaderName)) re.NoError(controller.RemoveScheduler(schedulers.BalanceRegionName)) re.NoError(controller.RemoveScheduler(schedulers.HotRegionName)) - re.NoError(controller.RemoveScheduler(schedulers.BalanceWitnessName)) - re.NoError(controller.RemoveScheduler(schedulers.TransferWitnessLeaderName)) re.Empty(controller.GetSchedulerNames()) stream := mockhbstream.NewHeartbeatStream() @@ -3133,13 +3131,12 @@ func TestPersistScheduler(t *testing.T) { re.NoError(err) re.Len(sches, defaultCount+2) - // remove 5 schedulers + // remove 3 schedulers re.NoError(controller.RemoveScheduler(schedulers.BalanceLeaderName)) re.NoError(controller.RemoveScheduler(schedulers.BalanceRegionName)) re.NoError(controller.RemoveScheduler(schedulers.HotRegionName)) - re.NoError(controller.RemoveScheduler(schedulers.BalanceWitnessName)) - re.NoError(controller.RemoveScheduler(schedulers.TransferWitnessLeaderName)) - re.Len(controller.GetSchedulerNames(), defaultCount-3) + // only remains 2 items with independent config. + re.Len(controller.GetSchedulerNames(), 2) re.NoError(co.GetCluster().GetSchedulerConfig().Persist(storage)) co.Stop() co.GetSchedulersController().Wait() @@ -3190,7 +3187,7 @@ func TestPersistScheduler(t *testing.T) { brs, err := schedulers.CreateScheduler(schedulers.BalanceRegionType, oc, storage, schedulers.ConfigSliceDecoder(schedulers.BalanceRegionType, []string{"", ""})) re.NoError(err) re.NoError(controller.AddScheduler(brs)) - re.Len(controller.GetSchedulerNames(), defaultCount) + re.Len(controller.GetSchedulerNames(), 5) // the scheduler option should contain 6 items // the `hot scheduler` are disabled @@ -3211,9 +3208,9 @@ func TestPersistScheduler(t *testing.T) { co.Run() controller = co.GetSchedulersController() - re.Len(controller.GetSchedulerNames(), defaultCount-1) + re.Len(controller.GetSchedulerNames(), 4) re.NoError(controller.RemoveScheduler(schedulers.EvictLeaderName)) - re.Len(controller.GetSchedulerNames(), defaultCount-2) + re.Len(controller.GetSchedulerNames(), 3) } func TestRemoveScheduler(t *testing.T) { @@ -3249,8 +3246,6 @@ func TestRemoveScheduler(t *testing.T) { re.NoError(controller.RemoveScheduler(schedulers.BalanceRegionName)) re.NoError(controller.RemoveScheduler(schedulers.HotRegionName)) re.NoError(controller.RemoveScheduler(schedulers.GrantLeaderName)) - re.NoError(controller.RemoveScheduler(schedulers.BalanceWitnessName)) - re.NoError(controller.RemoveScheduler(schedulers.TransferWitnessLeaderName)) // all removed sches, _, err = storage.LoadAllSchedulerConfigs() re.NoError(err) diff --git a/tests/integrations/mcs/scheduling/server_test.go b/tests/integrations/mcs/scheduling/server_test.go index 324c8e5cad5..f1312c71ebf 100644 --- a/tests/integrations/mcs/scheduling/server_test.go +++ b/tests/integrations/mcs/scheduling/server_test.go @@ -126,7 +126,7 @@ func (suite *serverTestSuite) TestPrimaryChange() { tc.WaitForPrimaryServing(re) primary := tc.GetPrimaryServer() oldPrimaryAddr := primary.GetAddr() - re.Len(primary.GetCluster().GetCoordinator().GetSchedulersController().GetSchedulerNames(), 5) + re.Len(primary.GetCluster().GetCoordinator().GetSchedulersController().GetSchedulerNames(), 3) testutil.Eventually(re, func() bool { watchedAddr, ok := suite.pdLeader.GetServicePrimaryAddr(suite.ctx, mcs.SchedulingServiceName) return ok && oldPrimaryAddr == watchedAddr @@ -137,7 +137,7 @@ func (suite *serverTestSuite) TestPrimaryChange() { primary = tc.GetPrimaryServer() newPrimaryAddr := primary.GetAddr() re.NotEqual(oldPrimaryAddr, newPrimaryAddr) - re.Len(primary.GetCluster().GetCoordinator().GetSchedulersController().GetSchedulerNames(), 5) + re.Len(primary.GetCluster().GetCoordinator().GetSchedulersController().GetSchedulerNames(), 3) testutil.Eventually(re, func() bool { watchedAddr, ok := suite.pdLeader.GetServicePrimaryAddr(suite.ctx, mcs.SchedulingServiceName) return ok && newPrimaryAddr == watchedAddr diff --git a/tests/pdctl/scheduler/scheduler_test.go b/tests/pdctl/scheduler/scheduler_test.go index fb344ecebee..eb62029a608 100644 --- a/tests/pdctl/scheduler/scheduler_test.go +++ b/tests/pdctl/scheduler/scheduler_test.go @@ -111,11 +111,9 @@ func (suite *schedulerTestSuite) checkScheduler(cluster *tests.TestCluster) { // scheduler show command expected := map[string]bool{ - "balance-region-scheduler": true, - "balance-leader-scheduler": true, - "balance-hot-region-scheduler": true, - "transfer-witness-leader-scheduler": true, - "balance-witness-scheduler": true, + "balance-region-scheduler": true, + "balance-leader-scheduler": true, + "balance-hot-region-scheduler": true, } checkSchedulerCommand(nil, expected) @@ -123,10 +121,8 @@ func (suite *schedulerTestSuite) checkScheduler(cluster *tests.TestCluster) { args := []string{"-u", pdAddr, "scheduler", "remove", "balance-region-scheduler"} time.Sleep(10 * time.Second) expected = map[string]bool{ - "balance-leader-scheduler": true, - "balance-hot-region-scheduler": true, - "transfer-witness-leader-scheduler": true, - "balance-witness-scheduler": true, + "balance-leader-scheduler": true, + "balance-hot-region-scheduler": true, } checkSchedulerCommand(args, expected) @@ -136,11 +132,9 @@ func (suite *schedulerTestSuite) checkScheduler(cluster *tests.TestCluster) { // scheduler add command args = []string{"-u", pdAddr, "scheduler", "add", schedulers[idx], "2"} expected = map[string]bool{ - "balance-leader-scheduler": true, - "balance-hot-region-scheduler": true, - schedulers[idx]: true, - "transfer-witness-leader-scheduler": true, - "balance-witness-scheduler": true, + "balance-leader-scheduler": true, + "balance-hot-region-scheduler": true, + schedulers[idx]: true, } checkSchedulerCommand(args, expected) @@ -152,11 +146,9 @@ func (suite *schedulerTestSuite) checkScheduler(cluster *tests.TestCluster) { // scheduler config update command args = []string{"-u", pdAddr, "scheduler", "config", schedulers[idx], "add-store", "3"} expected = map[string]bool{ - "balance-leader-scheduler": true, - "balance-hot-region-scheduler": true, - schedulers[idx]: true, - "transfer-witness-leader-scheduler": true, - "balance-witness-scheduler": true, + "balance-leader-scheduler": true, + "balance-hot-region-scheduler": true, + schedulers[idx]: true, } checkSchedulerCommand(args, expected) @@ -167,32 +159,26 @@ func (suite *schedulerTestSuite) checkScheduler(cluster *tests.TestCluster) { // scheduler delete command args = []string{"-u", pdAddr, "scheduler", "remove", schedulers[idx]} expected = map[string]bool{ - "balance-leader-scheduler": true, - "balance-hot-region-scheduler": true, - "transfer-witness-leader-scheduler": true, - "balance-witness-scheduler": true, + "balance-leader-scheduler": true, + "balance-hot-region-scheduler": true, } checkSchedulerCommand(args, expected) // scheduler add command args = []string{"-u", pdAddr, "scheduler", "add", schedulers[idx], "2"} expected = map[string]bool{ - "balance-leader-scheduler": true, - "balance-hot-region-scheduler": true, - schedulers[idx]: true, - "transfer-witness-leader-scheduler": true, - "balance-witness-scheduler": true, + "balance-leader-scheduler": true, + "balance-hot-region-scheduler": true, + schedulers[idx]: true, } checkSchedulerCommand(args, expected) // scheduler add command twice args = []string{"-u", pdAddr, "scheduler", "add", schedulers[idx], "4"} expected = map[string]bool{ - "balance-leader-scheduler": true, - "balance-hot-region-scheduler": true, - schedulers[idx]: true, - "transfer-witness-leader-scheduler": true, - "balance-witness-scheduler": true, + "balance-leader-scheduler": true, + "balance-hot-region-scheduler": true, + schedulers[idx]: true, } checkSchedulerCommand(args, expected) @@ -203,11 +189,9 @@ func (suite *schedulerTestSuite) checkScheduler(cluster *tests.TestCluster) { // scheduler remove command [old] args = []string{"-u", pdAddr, "scheduler", "remove", schedulers[idx] + "-4"} expected = map[string]bool{ - "balance-leader-scheduler": true, - "balance-hot-region-scheduler": true, - schedulers[idx]: true, - "transfer-witness-leader-scheduler": true, - "balance-witness-scheduler": true, + "balance-leader-scheduler": true, + "balance-hot-region-scheduler": true, + schedulers[idx]: true, } checkSchedulerCommand(args, expected) @@ -218,21 +202,17 @@ func (suite *schedulerTestSuite) checkScheduler(cluster *tests.TestCluster) { // scheduler remove command, when remove the last store, it should remove whole scheduler args = []string{"-u", pdAddr, "scheduler", "remove", schedulers[idx] + "-2"} expected = map[string]bool{ - "balance-leader-scheduler": true, - "balance-hot-region-scheduler": true, - "transfer-witness-leader-scheduler": true, - "balance-witness-scheduler": true, + "balance-leader-scheduler": true, + "balance-hot-region-scheduler": true, } checkSchedulerCommand(args, expected) } // test shuffle region config checkSchedulerCommand([]string{"-u", pdAddr, "scheduler", "add", "shuffle-region-scheduler"}, map[string]bool{ - "balance-leader-scheduler": true, - "balance-hot-region-scheduler": true, - "shuffle-region-scheduler": true, - "transfer-witness-leader-scheduler": true, - "balance-witness-scheduler": true, + "balance-leader-scheduler": true, + "balance-hot-region-scheduler": true, + "shuffle-region-scheduler": true, }) var roles []string mustExec(re, cmd, []string{"-u", pdAddr, "scheduler", "config", "shuffle-region-scheduler", "show-roles"}, &roles) @@ -245,12 +225,10 @@ func (suite *schedulerTestSuite) checkScheduler(cluster *tests.TestCluster) { // test grant hot region scheduler config checkSchedulerCommand([]string{"-u", pdAddr, "scheduler", "add", "grant-hot-region-scheduler", "1", "1,2,3"}, map[string]bool{ - "balance-leader-scheduler": true, - "balance-hot-region-scheduler": true, - "shuffle-region-scheduler": true, - "grant-hot-region-scheduler": true, - "transfer-witness-leader-scheduler": true, - "balance-witness-scheduler": true, + "balance-leader-scheduler": true, + "balance-hot-region-scheduler": true, + "shuffle-region-scheduler": true, + "grant-hot-region-scheduler": true, }) var conf3 map[string]interface{} expected3 := map[string]interface{}{ diff --git a/tests/server/cluster/cluster_test.go b/tests/server/cluster/cluster_test.go index 3b70e837ac5..2c371190cd9 100644 --- a/tests/server/cluster/cluster_test.go +++ b/tests/server/cluster/cluster_test.go @@ -1416,7 +1416,7 @@ func TestTransferLeaderForScheduler(t *testing.T) { }) // Check scheduler updated. schedulersController := rc.GetCoordinator().GetSchedulersController() - re.Len(schedulersController.GetSchedulerNames(), 6) + re.Len(schedulersController.GetSchedulerNames(), 4) checkEvictLeaderSchedulerExist(re, schedulersController, true) checkEvictLeaderStoreIDs(re, schedulersController, []uint64{1, 2}) @@ -1436,7 +1436,7 @@ func TestTransferLeaderForScheduler(t *testing.T) { re.True(leaderServer.GetRaftCluster().IsPrepared()) // Check scheduler updated. schedulersController = rc1.GetCoordinator().GetSchedulersController() - re.Len(schedulersController.GetSchedulerNames(), 6) + re.Len(schedulersController.GetSchedulerNames(), 4) checkEvictLeaderSchedulerExist(re, schedulersController, true) checkEvictLeaderStoreIDs(re, schedulersController, []uint64{1, 2}) @@ -1455,7 +1455,7 @@ func TestTransferLeaderForScheduler(t *testing.T) { re.True(leaderServer.GetRaftCluster().IsPrepared()) // Check scheduler updated schedulersController = rc.GetCoordinator().GetSchedulersController() - re.Len(schedulersController.GetSchedulerNames(), 6) + re.Len(schedulersController.GetSchedulerNames(), 4) checkEvictLeaderSchedulerExist(re, schedulersController, true) checkEvictLeaderStoreIDs(re, schedulersController, []uint64{1, 2})