-
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
schemachanger/rel: fix race due to failure to clone constraint slots #88670
Conversation
ac66c97
to
11adfa6
Compare
In practice this bug was less severe than it sounded -- the values used in these slots are always constants and are never data-dependent constants, so the value we'll fill always ends up being the same unless the query were about structs or strings. We currently never search by strings, but if we did, we would have had a bug. I'm adding some more targeted tests. |
11adfa6
to
139ad31
Compare
Alrighty, I wrote a better, lower-level test. |
139ad31
to
f67e80d
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.
One minor nit with an incomplete comment
Reviewed 7 of 7 files at r1, all commit messages.
Reviewable status: complete! 1 of 0 LGTMs obtained (waiting on @ajwerner)
pkg/sql/schemachanger/rel/query_eval.go
line 51 at r1 (raw file):
for i := range clone { // If there are any slots which map to a set of allowed values, we need // to clone those values because during query evaluation, we'll
The comment is incomplete here?
f67e80d
to
eb01e91
Compare
TFTR! |
The fundamental race here is that while the slots themselves were being copied by value, the "any" clauses which are a slice were not. The second bug here is that the "inline" values were not being properly reset. That bug could lead to problems when the query was run again in the context of a different element set. We need to reset those inline values too. Fixes cockroachdb#88628 Release note: None
eb01e91
to
8126b7e
Compare
bors r+ |
Build succeeded: |
Encountered an error creating backports. Some common things that can go wrong:
You might need to create your backport manually using the backport tool. error creating merge commit from 8126b7e to blathers/backport-release-22.1-88670: POST https://api.github.com/repos/cockroachdb/cockroach/merges: 409 Merge conflict [] you may need to manually resolve merge conflicts with the backport tool. Backport to branch 22.1.x failed. See errors above. error creating merge commit from 8126b7e to blathers/backport-release-22.2-88670: POST https://api.github.com/repos/cockroachdb/cockroach/merges: 409 Merge conflict [] you may need to manually resolve merge conflicts with the backport tool. Backport to branch 22.2.x failed. See errors above. 🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is otan. |
The fundamental race here is that while the slots themselves were being copied by value, the "any" clauses which are a slice were not. The second bug here is that the "inline" values were not being properly reset. That bug could lead to problems when the query was run again in the context of a different element set. We need to reset those inline values too.
Fixes #88628
Release note: None