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

Revert "pdms: add name to start pdms" #2424

Merged
merged 1 commit into from
May 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
11 changes: 1 addition & 10 deletions components/playground/instance/pd.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,7 @@ func (inst *PDInstance) InitCluster(pds []*PDInstance) *PDInstance {

// Name return the name of pd.
func (inst *PDInstance) Name() string {
switch inst.Role {
case PDRoleTSO:
return fmt.Sprintf("tso-%d", inst.ID)
case PDRoleScheduling:
return fmt.Sprintf("scheduling-%d", inst.ID)
default:
return fmt.Sprintf("pd-%d", inst.ID)
}
return fmt.Sprintf("pd-%d", inst.ID)
}

// Start calls set inst.cmd and Start
Expand Down Expand Up @@ -144,7 +137,6 @@ func (inst *PDInstance) Start(ctx context.Context, version utils.Version) error
args = []string{
"services",
"tso",
"--name=" + uid,
fmt.Sprintf("--listen-addr=http://%s", utils.JoinHostPort(inst.Host, inst.StatusPort)),
fmt.Sprintf("--advertise-listen-addr=http://%s", utils.JoinHostPort(AdvertiseHost(inst.Host), inst.StatusPort)),
fmt.Sprintf("--backend-endpoints=%s", strings.Join(endpoints, ",")),
Expand All @@ -156,7 +148,6 @@ func (inst *PDInstance) Start(ctx context.Context, version utils.Version) error
args = []string{
"services",
"scheduling",
"--name=" + uid,
fmt.Sprintf("--listen-addr=http://%s", utils.JoinHostPort(inst.Host, inst.StatusPort)),
fmt.Sprintf("--advertise-listen-addr=http://%s", utils.JoinHostPort(AdvertiseHost(inst.Host), inst.StatusPort)),
fmt.Sprintf("--backend-endpoints=%s", strings.Join(endpoints, ",")),
Expand Down
1 change: 0 additions & 1 deletion embed/templates/scripts/run_scheduling.sh.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ exec numactl --cpunodebind={{.NumaNode}} --membind={{.NumaNode}} env GODEBUG=mad
{{- else}}
exec env GODEBUG=madvdontneed=1 bin/pd-server services scheduling \
{{- end}}
--name="{{.Name}}" \
--backend-endpoints="{{.BackendEndpoints}}" \
--listen-addr="{{.ListenURL}}" \
--advertise-listen-addr="{{.AdvertiseListenURL}}" \
Expand Down
1 change: 0 additions & 1 deletion embed/templates/scripts/run_tso.sh.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ exec numactl --cpunodebind={{.NumaNode}} --membind={{.NumaNode}} env GODEBUG=mad
{{- else}}
exec env GODEBUG=madvdontneed=1 bin/pd-server services tso \
{{- end}}
--name="{{.Name}}" \
--backend-endpoints="{{.BackendEndpoints}}" \
--listen-addr="{{.ListenURL}}" \
--advertise-listen-addr="{{.AdvertiseListenURL}}" \
Expand Down
5 changes: 1 addition & 4 deletions pkg/cluster/spec/scheduling.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ import (

// SchedulingSpec represents the scheduling topology specification in topology.yaml
type SchedulingSpec struct {
// Use Name to get the name with a default value if it's empty.
Name string `yaml:"name"`
Host string `yaml:"host"`
ManageHost string `yaml:"manage_host,omitempty" validate:"manage_host:editable"`
ListenHost string `yaml:"listen_host,omitempty"`
Expand Down Expand Up @@ -171,7 +169,7 @@ func (c *SchedulingComponent) Instances() []Instance {
ins = append(ins, &SchedulingInstance{
BaseInstance: BaseInstance{
InstanceSpec: s,
Name: s.Name,
Name: c.Name(),
Host: s.Host,
ManageHost: s.ManageHost,
ListenHost: utils.Ternary(s.ListenHost != "", s.ListenHost, c.Topology.BaseTopo().GlobalOptions.ListenHost).(string),
Expand Down Expand Up @@ -231,7 +229,6 @@ func (i *SchedulingInstance) InitConfig(
pds = append(pds, pdspec.GetAdvertiseClientURL(enableTLS))
}
cfg := &scripts.SchedulingScript{
Name: spec.Name,
ListenURL: fmt.Sprintf("%s://%s", scheme, utils.JoinHostPort(i.GetListenHost(), spec.Port)),
AdvertiseListenURL: spec.GetAdvertiseListenURL(enableTLS),
BackendEndpoints: strings.Join(pds, ","),
Expand Down
5 changes: 1 addition & 4 deletions pkg/cluster/spec/tso.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ import (

// TSOSpec represents the TSO topology specification in topology.yaml
type TSOSpec struct {
// Use Name to get the name with a default value if it's empty.
Name string `yaml:"name"`
Host string `yaml:"host"`
ManageHost string `yaml:"manage_host,omitempty" validate:"manage_host:editable"`
ListenHost string `yaml:"listen_host,omitempty"`
Expand Down Expand Up @@ -171,7 +169,7 @@ func (c *TSOComponent) Instances() []Instance {
ins = append(ins, &TSOInstance{
BaseInstance: BaseInstance{
InstanceSpec: s,
Name: s.Name,
Name: c.Name(),
Host: s.Host,
ManageHost: s.ManageHost,
ListenHost: utils.Ternary(s.ListenHost != "", s.ListenHost, c.Topology.BaseTopo().GlobalOptions.ListenHost).(string),
Expand Down Expand Up @@ -231,7 +229,6 @@ func (i *TSOInstance) InitConfig(
pds = append(pds, pdspec.GetAdvertiseClientURL(enableTLS))
}
cfg := &scripts.TSOScript{
Name: spec.Name,
ListenURL: fmt.Sprintf("%s://%s", scheme, utils.JoinHostPort(i.GetListenHost(), spec.Port)),
AdvertiseListenURL: spec.GetAdvertiseListenURL(enableTLS),
BackendEndpoints: strings.Join(pds, ","),
Expand Down
34 changes: 0 additions & 34 deletions pkg/cluster/spec/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -984,38 +984,6 @@ func (s *Specification) validatePDNames() error {
return nil
}

func (s *Specification) validateTSONames() error {
// check tso server name
tsoNames := set.NewStringSet()
for _, tso := range s.TSOServers {
if tso.Name == "" {
continue
}

if tsoNames.Exist(tso.Name) {
return errors.Errorf("component tso_servers.name is not supported duplicated, the name %s is duplicated", tso.Name)
}
tsoNames.Insert(tso.Name)
}
return nil
}

func (s *Specification) validateSchedulingNames() error {
// check scheduling server name
schedulingNames := set.NewStringSet()
for _, scheduling := range s.SchedulingServers {
if scheduling.Name == "" {
continue
}

if schedulingNames.Exist(scheduling.Name) {
return errors.Errorf("component scheduling_servers.name is not supported duplicated, the name %s is duplicated", scheduling.Name)
}
schedulingNames.Insert(scheduling.Name)
}
return nil
}

func (s *Specification) validateTiFlashConfigs() error {
c := FindComponent(s, ComponentTiFlash)
for _, ins := range c.Instances() {
Expand Down Expand Up @@ -1095,8 +1063,6 @@ func (s *Specification) Validate() error {
s.dirConflictsDetect,
s.validateUserGroup,
s.validatePDNames,
s.validateTSONames,
s.validateSchedulingNames,
s.validateTiSparkSpec,
s.validateTiFlashConfigs,
s.validateMonitorAgent,
Expand Down
6 changes: 0 additions & 6 deletions pkg/cluster/template/scripts/scheduling.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,12 @@ import (
"path"
"text/template"

"github.com/pingcap/errors"
"github.com/pingcap/tiup/embed"
"github.com/pingcap/tiup/pkg/utils"
)

// SchedulingScript represent the data to generate scheduling config
type SchedulingScript struct {
Name string
ListenURL string
AdvertiseListenURL string
BackendEndpoints string
Expand All @@ -50,10 +48,6 @@ func (c *SchedulingScript) ConfigToFile(file string) error {
return err
}

if c.Name == "" {
return errors.New("empty name")
}

content := bytes.NewBufferString("")
if err := tmpl.Execute(content, c); err != nil {
return err
Expand Down
6 changes: 0 additions & 6 deletions pkg/cluster/template/scripts/tso.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,12 @@ import (
"path"
"text/template"

"github.com/pingcap/errors"
"github.com/pingcap/tiup/embed"
"github.com/pingcap/tiup/pkg/utils"
)

// TSOScript represent the data to generate tso config
type TSOScript struct {
Name string
ListenURL string
AdvertiseListenURL string
BackendEndpoints string
Expand All @@ -50,10 +48,6 @@ func (c *TSOScript) ConfigToFile(file string) error {
return err
}

if c.Name == "" {
return errors.New("empty name")
}

content := bytes.NewBufferString("")
if err := tmpl.Execute(content, c); err != nil {
return err
Expand Down
Loading