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

opt: do not mutate GenerateConstrainedScans input filters #55391

Merged
merged 1 commit into from
Oct 10, 2020

Conversation

mgartner
Copy link
Collaborator

@mgartner mgartner commented Oct 9, 2020

This commit fixes a bug in GenerateConstrainedScans which can cause
incorrect query results in tables with a partial index. Filters reduced
while proving implication of a partial index would mutate the input
filters. These filters would remain mutated for future iterations over
other indexes, causing constrained scans to be created without these
necessary filters.

Fixes #55387

Release justification: This fixes a critical correctness bug for a new
feature, partial indexes.

Release note (bug fix): A bug was fixed that caused incorrect query
results on tables with partial indexes. This bug did not affect any
queries involving tables without partial indexes.

This commit fixes a bug in GenerateConstrainedScans which can cause
incorrect query results in tables with a partial index. Filters reduced
while proving implication of a partial index would mutate the input
filters. These filters would remain mutated for future iterations over
other indexes, causing constrained scans to be created without these
necessary filters.

Fixes cockroachdb#55387

Release justification: This fixes a critical correctness bug for a new
feature, partial indexes.

Release note (bug fix): A bug was fixed that caused incorrect query
results on tables with partial indexes. This bug did not affect any
queries involving tables without partial indexes.
@mgartner mgartner requested a review from a team as a code owner October 9, 2020 18:58
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@mgartner
Copy link
Collaborator Author

mgartner commented Oct 9, 2020

bors r=RaduBerinde

@craig
Copy link
Contributor

craig bot commented Oct 9, 2020

Build failed (retrying...):

@craig
Copy link
Contributor

craig bot commented Oct 10, 2020

Build succeeded:

@craig craig bot merged commit f5bd55d into cockroachdb:master Oct 10, 2020
@mgartner mgartner deleted the 55387-constrained-scans branch October 10, 2020 00:12
@rafiss rafiss added this to the 20.2 milestone Apr 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

opt: GenerateConstrainedScans incorrectly removes filters causing incorrect results
4 participants