-
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
release-22.2: opt: backport fix for ordering-related optimizer panics to v22.2 #113175
release-22.2: opt: backport fix for ordering-related optimizer panics to v22.2 #113175
Conversation
It is possible for some functional-dependency information to be visible to a child operator but invisible to its parent. This could previously cause panics when a child provided an ordering that could be proven to satisfy the required ordering with the child FDs, but not with the parent's FDs. This patch adds a step to the logic that builds provided orderings that ensures a provided ordering can be proven to respect the required ordering without needing additional FD information. This ensures that a parent never needs to know its child's FDs in order to prove that the provided ordering is correct. The extra step is a no-op in the common case when the provided ordering can already be proven to respect the required ordering. Informs cockroachdb#85393 Informs cockroachdb#87806 Fixes cockroachdb#96288 Release note (bug fix): Fixed a rare internal error in the optimizer that has existed since before version 22.1, which could occur while enforcing orderings between SQL operators.
This patch adds a new session setting, `optimizer_use_provided_ordering_fix`, which toggles whether to use the `finalizeProvided` function introduced in required ordering. This setting is on by default, and will be used when backporting cockroachdb#100776. Informs cockroachdb#113072 Release note: None
Yes - there's a default-on setting that can be disabled to disable this change.
If we introduced a bug into the ordering logic, we could cause internal errors and/or incorrect results. This has already baked for months on 23.1 and master, and has an escape hatch, so the risk should be low.
This fixes an incorrect results bug that a customer has hit. |
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.
Reviewed 3 of 3 files at r1, 13 of 13 files at r2, all commit messages.
Reviewable status: complete! 1 of 0 LGTMs obtained (waiting on @rafiss)
Merging since an extraordinary release request has been submitted for this. |
blathers backport staging-v22.2.16 |
Backport:
Please see individual PRs for details.
/cc @cockroachdb/release
Release justification: Fix for internal error and possible incorrect results in the optimizer.