diff --git a/pkg/mcs/scheduling/server/cluster.go b/pkg/mcs/scheduling/server/cluster.go index 7e011bc547c..6f80572673c 100644 --- a/pkg/mcs/scheduling/server/cluster.go +++ b/pkg/mcs/scheduling/server/cluster.go @@ -257,8 +257,8 @@ func (c *Cluster) triggerMembershipCheck() { } } -// SwitchPDLeader switches the PD service leader. -func (c *Cluster) SwitchPDLeader(new pdpb.PDClient) bool { +// SwitchPDServiceLeader switches the PD service leader. +func (c *Cluster) SwitchPDServiceLeader(new pdpb.PDClient) bool { old := c.pdLeader.Load() return c.pdLeader.CompareAndSwap(old, new) } diff --git a/pkg/mcs/scheduling/server/server.go b/pkg/mcs/scheduling/server/server.go index 6890745fc35..80156c1e26b 100644 --- a/pkg/mcs/scheduling/server/server.go +++ b/pkg/mcs/scheduling/server/server.go @@ -220,7 +220,7 @@ func (s *Server) updatePDServiceMemberLoop() { // double check break } - if s.cluster.SwitchPDLeader(pdpb.NewPDClient(cc)) { + if s.cluster.SwitchPDServiceLeader(pdpb.NewPDClient(cc)) { if status.Leader != curLeader { log.Info("switch leader", zap.String("leader-id", fmt.Sprintf("%x", ep.ID)), zap.String("endpoint", ep.ClientURLs[0])) } diff --git a/tools/pd-ctl/pdctl/command/config_command.go b/tools/pd-ctl/pdctl/command/config_command.go index 7161e46b8ea..f89c63bc51c 100644 --- a/tools/pd-ctl/pdctl/command/config_command.go +++ b/tools/pd-ctl/pdctl/command/config_command.go @@ -50,7 +50,7 @@ const ( pdServerPrefix = "pd/api/v1/config/pd-server" serviceMiddlewareConfigPrefix = "pd/api/v1/service-middleware/config" // flagFromPDService has no influence for pd mode, but it is useful for us to debug in pd service mode. - flagFromPDService = "from_api_server" + flagFromPDService = "from_pd_service" ) // NewConfigCommand return a config subcommand of rootCmd diff --git a/tools/pd-ctl/tests/config/config_test.go b/tools/pd-ctl/tests/config/config_test.go index 12083abc2f6..39820a6c7b7 100644 --- a/tools/pd-ctl/tests/config/config_test.go +++ b/tools/pd-ctl/tests/config/config_test.go @@ -449,7 +449,7 @@ func (suite *configTestSuite) checkConfigForwardControl(cluster *pdTests.TestClu args := []string{"-u", pdAddr, "config", "show"} args = append(args, options...) if isFromPDService { - args = append(args, "--from_api_server") + args = append(args, "--from_pd_service") } output, err := tests.ExecuteCommand(cmd, args...) re.NoError(err) @@ -478,7 +478,7 @@ func (suite *configTestSuite) checkConfigForwardControl(cluster *pdTests.TestClu args := []string{"-u", pdAddr, "config", "placement-rules"} args = append(args, options...) if isFromPDService { - args = append(args, "--from_api_server") + args = append(args, "--from_pd_service") } output, err := tests.ExecuteCommand(cmd, args...) re.NoError(err)