-
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: internal error: in-between filters didn't yield a constraint #80820
Comments
roachtest.sqlsmith/setup=rand-tables/setting=no-mutations failed with artifacts on master @ c9e0194b19a03d55c6be92572aad3fbafc256334:
|
This reproduces on 21.2 and 22.1. Not a release blocker. Steps to reproduce:
|
Still working on this, but here is a reduced repro:
The issue seems to be that we're trying to make a constrained scan over the partitioned index, but for some reason we aren't able to generate a constraint using the index partitions, index constraint, and query constraint. This seems like something we should be able to do. |
SQLSmith keeps on hitting a known "in-between filters didn't yield a constraint" error, so let's silence it for now. Informs cockroachdb#80820 Release note: None
80548: sql: add a SET CLUSTER SETTING sql.defaults deprecation notice r=rafiss a=e-mbrown Resolves #80325 Added a deprecation notice for when `SET CLUSTER SETTINGS sql.defaults...` is used. The notice directs users to use the `ALTER ROLE` syntax instead Release note: None 81063: storage: remove slow path for MVCCResolveWriteIntentRange r=nvanbenschoten a=sumeerbhola We no longer have physically interleaved intents, that needed the slow path. Release note: None 81174: ccl/sqlproxyccl: remove the idle monitor component r=JeffSwenson a=jaylim-crl This commit removes the idle monitor component from the sqlproxy as there's no strong use case for it, as discussed. This is currently not being used anywhere on CockroachCloud, and with the connection migration feature, it's unlikely that we will need this. When a pod goes into the draining state, all connections are migrated away to other running pods. Even though the idle monitor may benefit us by terminating idle connections earlier for connections that cannot be migrated, the complexity of maintaining this outweighs the benefits that we get (i.e. being able to shut down a pod earlier; between 1 to 10 minutes rather than waiting until 10 minutes for forceful termination). At the same time, the --drain-timeout flag has been removed from the `mt start-proxy` command as well. Release note: None 81243: opt: fix outdated optgen comment r=mgartner a=mgartner This commit removes a reference to the `DetectCycle` rule tag which is no longer supported. Release note: None 81291: roachtest: silence known sqlsmith error for in-between filters r=rytaft a=rytaft SQLSmith keeps on hitting a known "in-between filters didn't yield a constraint" error, so let's silence it for now. Informs #80820 Release note: None Co-authored-by: e-mbrown <ebsonari@gmail.com> Co-authored-by: sumeerbhola <sumeer@cockroachlabs.com> Co-authored-by: Jay <jay@cockroachlabs.com> Co-authored-by: Marcus Gartner <marcus@cockroachlabs.com> Co-authored-by: Rebecca Taft <becca@cockroachlabs.com>
The most recent failure of #81094 is this:
|
I was debugging this a bit on the plane, and I think I've figured out why we can't seem to produce a constrained scan in these cases. The code assumes that if we can make a constraint for the query and partition filters, then we should be able to make a constraint for the query and in-between filters. In the reduction above, the filters makes an expression that looks something like this:
The first part of the AND (col2 > 4) is unconstrained, which I suspect is because it is the third column in In the second part of the AND, since col0 and col1 have different orderings, we can only constrain on col0. As a result we end up merging spans Is it impossible to make a constrained scan using index columns that have different orderings? Maybe the solution here is to loosen the assumption that a constrained partition filter will also have a constrained in-between filter, not panic, and allow the xform rule GenerateConstrainedScans to not generate scans in this case. |
I think it is possible to make a constrained scan of an index like this, although it might be trickier with non-numeric and nullable types. Since I was struggling to work with the types in the repro above, I created another (even more) reduced repro:
Normally, if the index had all columns ascending, we would construct in-between filters using tuples like this:
However, it's still possible to construct in-between filters for this schema as follows:
For example:
That being said, I'm not sure it's really worth it to figure out how to generalize the above logic. If we ever see a real-world schema that requires this we can try, but I'd rather not add the complexity unless we need it. Seems like the easiest approach is to just remove the assertion and return if |
Before this change, the optimizer assumed that if partition filters are constrained on an index then the in-between filters are also constrained, and would panic if it was unable to find a constraint. However, when an index is partitioned on multiple columns and the columns have different orders, the optimizer may be unable to generate a constraint for the in between filters of the partitions, even if the partition filters are constrained. This change removes the panic, since the assumption does not hold. As a consequence, the optimizer abondons the GenerateConstrainedScan rule, but doesn't crash. I did not include a release note since this appears to be a rare bug that we have not encountered in the wild. Fixes cockroachdb#80820 Release note: None
Before this change, the optimizer assumed that if partition filters are constrained on an index then the in-between filters are also constrained, and would panic if it was unable to find a constraint. However, when an index is partitioned on multiple columns and the columns have different orders, the optimizer may be unable to generate a constraint for the in between filters of the partitions, even if the partition filters are constrained. This change removes the panic, since the assumption does not hold. As a consequence, the optimizer abandons the GenerateConstrainedScan rule, but doesn't crash. I did not include a release note since this appears to be a rare bug that we have not encountered in the wild. Fixes cockroachdb#80820 Release note: None
80353: sql: enables distributed distsql queries for multi-tenant r=rharding6373 a=rharding6373 sql: enables distributed distsql queries for multi-tenant This change allows SQL queries to be distributed in multi-tenant environments. The distribution algorithm randomly assigns spans to SQL instances, but if only one instance is used the spans are assigned instead to the gateway instance. Distribution does not take locality into account, which will be implemented in a future PR. This change also supports running execbuilder tests with the 3node-tenant configuration, which is under CCL. These tests can be run in the following manner: ``` make test PKG=./pkg/ccl/logictestccl TESTS=TestTenantExecBuild ./dev test pkg/ccl/logictestccl -f=TestTenantExecBuild ``` Fixes: #80680 Release note: None 81452: release: publish latest docker tag for unstable releases r=rail a=rail Previously, when we published the pre-release docker images, we never touched the `latest` tag in the `cockroachdb/cockroach-unstable` docker repository, even though the script comments say we should. This patch adds a check to ensure we push every pre-release docker image with `latest` tag. Fixes #78663 Release note: None 81465: opt: remove panic when in between filters are not constrained r=rharding6373 a=rharding6373 Before this change, the optimizer assumed that if partition filters are constrained on an index then the in-between filters are also constrained, and would panic if it was unable to find a constraint. However, when an index is partitioned on multiple columns and the columns have different orders, the optimizer may be unable to generate a constraint for the in between filters of the partitions, even if the partition filters are constrained. This change removes the panic, since the assumption does not hold. As a consequence, the optimizer abandons the GenerateConstrainedScan rule, but doesn't crash. I did not include a release note since this appears to be a rare bug that we have not encountered in the wild. Fixes #80820 Release note: None Co-authored-by: rharding6373 <rharding6373@users.noreply.github.com> Co-authored-by: Rail Aliiev <rail@iqchoice.com>
Previously, if we ran in a mixed version state with the schema changer workload we could run into an optimizer bug (cockroachdb#80820). To address this, this patch in a mixed version workload disables the insert portion of the workload. Release justification: improves test coverage by enabling the mixed version test Release note: None
Previously, if we ran in a mixed version state with the schema changer workload we could run into an optimizer bug (cockroachdb#80820). To address this, this patch in a mixed version workload disables the insert portion of the workload. Release justification: improves test coverage by enabling the mixed version test Release note: None
Previously, if we ran in a mixed version state with the schema changer workload we could run into an optimizer bug (cockroachdb#80820). To address this, this patch in a mixed version workload disables the insert portion of the workload. Release justification: improves test coverage by enabling the mixed version test Release note: None
Previously, if we ran in a mixed version state with the schema changer workload we could run into an optimizer bug (#80820). To address this, this patch in a mixed version workload disables the insert portion of the workload. Release justification: improves test coverage by enabling the mixed version test Release note: None
Previously, if we ran in a mixed version state with the schema changer workload we could run into an optimizer bug (cockroachdb#80820). To address this, this patch in a mixed version workload disables the insert portion of the workload. Release justification: improves test coverage by enabling the mixed version test Release note: None
Previously, if we ran in a mixed version state with the schema changer workload we could run into an optimizer bug (cockroachdb#80820). To address this, this patch in a mixed version workload disables the insert portion of the workload. Release justification: improves test coverage by enabling the mixed version test Release note: None
roachtest.sqlsmith/setup=rand-tables/setting=no-mutations failed with artifacts on master @ a2e1910f51593bd2ef72e1d7c615e08f95791186:
Help
See: roachtest README
See: How To Investigate (internal)
This test on roachdash | Improve this report!
Jira issue: CRDB-15503
The text was updated successfully, but these errors were encountered: