Skip to content
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: column family span generation bugfix #40898

Merged

Conversation

jordanlewis
Copy link
Member

PR #38301 inadvertently introduced a bug that unfortunately wasn't
caught by any tests - in the process of improving the tight span
generation for tables with column families, it accidentally started
throwing away all but the spans for the final constraint passed in from
the optimizer.

This small omission has serious consequences: queries that have a
disjunction of spans to examine (like
SELECT * FROM t WHERE key IN (values...)) will return incorrect
results if the table being queried has multiple column families (in
certain cases) - it'll look like rows are missing. This will be
problematic for mutations as well.

Note that this bug was never present in a non-alpha release.

Fixes #40890.

Release note (bug fix): restore correct result generation for queries
with index disjunctions on tables with multiple column families.
Release justification: critical bugfix, low risk

PR cockroachdb#38301 inadvertently introduced a bug that unfortunately wasn't
caught by any tests - in the process of improving the tight span
generation for tables with column families, it accidentally started
throwing away all but the spans for the final constraint passed in from
the optimizer.

This small omission has serious consequences: queries that have a
disjunction of spans to examine (like
`SELECT * FROM t WHERE key IN (values...)`) will return incorrect
results if the table being queried has multiple column families (in
certain cases) - it'll look like rows are missing. This will be
problematic for mutations as well.

Note that this bug was never present in a non-alpha release.

Release note (bug fix): restore correct result generation for queries
with index disjunctions on tables with multiple column families.
Release justification: critical bugfix, low risk
@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Member

@RaduBerinde RaduBerinde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very surprising this didn't fail any tests.. I guess most things don't use column families. Maybe we should run certain tests (eg bigtest) in a mode where we default to a col fam per column.

@rohany
Copy link
Contributor

rohany commented Sep 18, 2019

Based on what I changed when writing that first pr this looks like the correct change. Sorry for introducing this...

@jordanlewis
Copy link
Member Author

No problem! There were no tests to catch the issue. @RaduBerinde I agree that such an idea is good. Hopefully random table generation and checking could also catch this, as our random table generator does create diverse column family setups. @mjibson, I would love to brainstorm with you about how to get smithcmp to get coverage of this class of issue.

bors r+

craig bot pushed a commit that referenced this pull request Sep 18, 2019
40898: sql: column family span generation bugfix r=jordanlewis a=jordanlewis

PR #38301 inadvertently introduced a bug that unfortunately wasn't
caught by any tests - in the process of improving the tight span
generation for tables with column families, it accidentally started
throwing away all but the spans for the final constraint passed in from
the optimizer.

This small omission has serious consequences: queries that have a
disjunction of spans to examine (like
`SELECT * FROM t WHERE key IN (values...)`) will return incorrect
results if the table being queried has multiple column families (in
certain cases) - it'll look like rows are missing. This will be
problematic for mutations as well.

Note that this bug was never present in a non-alpha release.

Fixes #40890.

Release note (bug fix): restore correct result generation for queries
with index disjunctions on tables with multiple column families.
Release justification: critical bugfix, low risk

Co-authored-by: Jordan Lewis <jordanthelewis@gmail.com>
@craig
Copy link
Contributor

craig bot commented Sep 19, 2019

Build succeeded

@craig craig bot merged commit e60d0c9 into cockroachdb:master Sep 19, 2019
@jordanlewis jordanlewis deleted the fix-multi-constraint-cf-span-creation branch September 19, 2019 02:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

sql: DELETE FROM is broken for system.jobs table
4 participants