-
Notifications
You must be signed in to change notification settings - Fork 312
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
Fix: duplicated pd_servers.name in the topology before truly deploy #922
Conversation
Codecov Report
@@ Coverage Diff @@
## master #922 +/- ##
=======================================
Coverage 55.22% 55.22%
=======================================
Files 261 261
Lines 19253 19262 +9
=======================================
+ Hits 10632 10638 +6
- Misses 6917 6919 +2
- Partials 1704 1705 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
9918e4b
to
ec88bb4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rest LGTM
pkg/cluster/spec/validate.go
Outdated
@@ -794,6 +794,22 @@ func (s *Specification) validateTLSEnabled() error { | |||
return nil | |||
} | |||
|
|||
func (s *Specification) validatePdPodNames() error { | |||
// check pdserver pod name | |||
if len(s.PDServers) > 1 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This check is redundant, prefer to remove the if statement
pkg/cluster/spec/validate.go
Outdated
@@ -794,6 +794,22 @@ func (s *Specification) validateTLSEnabled() error { | |||
return nil | |||
} | |||
|
|||
func (s *Specification) validatePdPodNames() error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
prefer to use the name validatePDNames
because Pod
is a term of K8S and we can really deploy TiDB to K8S. So we'd better change it to avoid misunderstanding
pkg/cluster/spec/validate.go
Outdated
func (s *Specification) validatePdPodNames() error { | ||
// check pdserver pod name | ||
if len(s.PDServers) > 1 { | ||
cnt := make(map[string]int) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer to use StringSet:
names := set.NewStringSet()
for _, pd := range s.PDServers {
if pd.Name == "" {
continue
}
if names.Exist(pd.Name) {
return errors.Errorf("xxxxxx")
}
names.Insert(pd.Name)
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
got it
f596265
to
36ed94f
Compare
/merge |
Your auto merge job has been accepted, waiting for:
|
/run-all-tests |
@anywhy merge failed. |
What problem does this PR solve?
fix #764 pd_servers.name has same name
What is changed and how it works?
Check List
Tests
Code changes
Side effects
Related changes
Release notes: