Skip to content

Commit

Permalink
Fix typo
Browse files Browse the repository at this point in the history
  • Loading branch information
anywhy committed Nov 21, 2020
1 parent ec88bb4 commit f596265
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions pkg/cluster/spec/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -794,18 +794,18 @@ func (s *Specification) validateTLSEnabled() error {
return nil
}

func (s *Specification) validatePdPodNames() error {
// check pdserver pod name
if len(s.PDServers) > 1 {
cnt := make(map[string]int)
for _, pd := range s.PDServers {
if pd.Name != "" {
if cnt[pd.Name] > 0 {
return errors.Errorf("component pd_servers.name is not supported duplicated, the name %s is duplicated", pd.Name)
}
cnt[pd.Name]++
}
func (s *Specification) validatePDNames() error {
// check pdserver name
pdNames := set.NewStringSet()
for _, pd := range s.PDServers {
if pd.Name == "" {
continue
}

if pdNames.Exist(pd.Name) {
return errors.Errorf("component pd_servers.name is not supported duplicated, the name %s is duplicated", pd.Name)
}
pdNames.Insert(pd.Name)
}
return nil
}
Expand Down Expand Up @@ -833,7 +833,7 @@ func (s *Specification) Validate() error {
return err
}

if err := s.validatePdPodNames(); err != nil {
if err := s.validatePDNames(); err != nil {
return err
}

Expand Down

0 comments on commit f596265

Please sign in to comment.