-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
sql: Fix bug in zone constraint validation for attributes. #39822
Conversation
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.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @andreimatei, @rohany, and @solongordon)
pkg/sql/set_zone_config.go, line 535 at r1 (raw file):
// Don't perform any validation for pairs with an empty key. // These attributes are not real key value pairs, and instead // are node attributes, such as +ssd.
Would it still make sense to check for conflicting attributes, like +ssd,-ssd
?
Fixes cockroachdb#39800. Release note: None
8ebe634
to
8758042
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.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @andreimatei and @solongordon)
pkg/sql/set_zone_config.go, line 535 at r1 (raw file):
Previously, solongordon (Solon) wrote…
Would it still make sense to check for conflicting attributes, like
+ssd,-ssd
?
you're right. PTAL
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.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @andreimatei, @rohany, and @solongordon)
pkg/sql/set_zone_config.go, line 537 at r2 (raw file):
// are attributes, due to the keys being the same for attributes. if curr.Key == "" && other.Key == "" { if curr.Value == other.Value {
Nit: You can combine these into a single if
. Also maybe we should also check that curr.Type != other.Type
? ["+ssd", "+ssd"]
is redundant but not really incompatible.
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.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @andreimatei and @solongordon)
pkg/sql/set_zone_config.go, line 537 at r2 (raw file):
Previously, solongordon (Solon) wrote…
Nit: You can combine these into a single
if
. Also maybe we should also check thatcurr.Type != other.Type
?["+ssd", "+ssd"]
is redundant but not really incompatible.
I had that originally, but we don't want that -- if the values are not equal (and the keys are both empty), then we fall into the other case and perform an incorrect validation sequence on the attributes. I can update the comment if that isn't clear.
I think we want to keep that +ssd and +ssd is invalid -- to me it looks like its a user error, and they should be notified (for example forgot to copy the correct node attributes in or something).
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.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @andreimatei, @rohany, and @solongordon)
pkg/sql/set_zone_config.go, line 537 at r2 (raw file):
Previously, rohany (Rohan Yadav) wrote…
I had that originally, but we don't want that -- if the values are not equal (and the keys are both empty), then we fall into the other case and perform an incorrect validation sequence on the attributes. I can update the comment if that isn't clear.
I think we want to keep that +ssd and +ssd is invalid -- to me it looks like its a user error, and they should be notified (for example forgot to copy the correct node attributes in or something).
Ah right, ok works for me.
bors r=solongordon |
Build succeeded |
Fixes #39800.
Release note: None