-
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
cluster: validate topo changes after edit-config #609
cluster: validate topo changes after edit-config #609
Conversation
7f6e6f9
to
eaad121
Compare
Codecov Report
@@ Coverage Diff @@
## master #609 +/- ##
==========================================
+ Coverage 51.20% 51.34% +0.14%
==========================================
Files 225 225
Lines 16573 16593 +20
==========================================
+ Hits 8486 8520 +34
+ Misses 6901 6888 -13
+ Partials 1186 1185 -1
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
eaad121
to
4b47b8b
Compare
pkg/cluster/edit/diff.go
Outdated
pathEditable := true | ||
pathIgnore := false | ||
for _, p := range c.Path { | ||
if _, err := strconv.Atoi(p); err == nil { |
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.
I think we cannot ignore the slice, for example, user add a new host into tidb_servers
.
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.
tidb_servers
is not ignored, server_configs.tidb
is.
pkg/cluster/edit/diff.go
Outdated
continue | ||
} | ||
} | ||
msg = append(msg, fmt.Sprintf("(%s) %s '%v' -> '%v'", c.Type, strings.Join(c.Path, "."), c.From, c.To)) |
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.
I think we should generate more readable error message. e.g:
- update:
cannot change the xxx field from 1 to 2
- delete:
cannot delete the field xxx
- create:
cannot add the field xxx into yyy
4b47b8b
to
2c2e8b8
Compare
2c2e8b8
to
76aa890
Compare
/merge |
/run-all-tests |
What problem does this PR solve?
add validation for topology diff to forbid changes of immutable fields
Check List
Tests
Code changes
Side effects
Related changes