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
Indexes with groups erroneously accept deleteRecordsWhere queries on grouped columns #1583
Labels
bug
Something isn't working
Comments
alecgrieser
added a commit
to alecgrieser/fdb-record-layer
that referenced
this issue
Apr 4, 2022
…eRecordsWhere queries on grouped columns This adjusts the methods used by `canDeleteWhere` on indexes defined on a `GroupingKeyExpression` so that it tries to satisfy the query from the grouping sub key rather than the whole key to limit the number of accepted `deleteRecordsWhere` predicates to more closely align with that is actually possible to safely delete. This includes some regression tests that hit the error, as well as a small amount of refactoring that is to set up FoundationDB#1580. This fixes FoundationDB#1583.
alecgrieser
added a commit
to alecgrieser/fdb-record-layer
that referenced
this issue
Apr 4, 2022
…eRecordsWhere queries on grouped columns This adjusts the methods used by `canDeleteWhere` on indexes defined on a `GroupingKeyExpression` so that it tries to satisfy the query from the grouping sub key rather than the whole key to limit the number of accepted `deleteRecordsWhere` predicates to more closely align with that is actually possible to safely delete. This includes some regression tests that hit the error, as well as a small amount of refactoring that is to set up FoundationDB#1580. This fixes FoundationDB#1583.
alecgrieser
added a commit
to alecgrieser/fdb-record-layer
that referenced
this issue
Apr 5, 2022
…eRecordsWhere queries on grouped columns This adjusts the methods used by `canDeleteWhere` on indexes defined on a `GroupingKeyExpression` so that it tries to satisfy the query from the grouping sub key rather than the whole key to limit the number of accepted `deleteRecordsWhere` predicates to more closely align with that is actually possible to safely delete. This includes some regression tests that hit the error, as well as a small amount of refactoring that is to set up FoundationDB#1580. This fixes FoundationDB#1583.
alecgrieser
added a commit
to alecgrieser/fdb-record-layer
that referenced
this issue
Apr 6, 2022
…eRecordsWhere queries on grouped columns This adjusts the methods used by `canDeleteWhere` on indexes defined on a `GroupingKeyExpression` so that it tries to satisfy the query from the grouping sub key rather than the whole key to limit the number of accepted `deleteRecordsWhere` predicates to more closely align with that is actually possible to safely delete. This includes some regression tests that hit the error, as well as a small amount of refactoring that is to set up FoundationDB#1580. This fixes FoundationDB#1583.
ScottDugas
added a commit
that referenced
this issue
Apr 7, 2022
…ouping Fixes #1583: Indexes with groups erroneously accept deleteRecordsWhere queries on grouped columns
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
On indexes with a grouping, like the atomic mutation indexes or the rank indexes, the
canDeleteWhere
function should returntrue
only if the delete-where predicate can be satisfied by the grouping columns. For example, if you had aSUM
index onfield("foo").groupBy(field("bar"))
, the index can allow delete where requests with predicates likeQuery.field("bar").equalsValue(x)
, but it should reject queries with predicates likeQuery.and(Query.field("bar").equalsValue(x), Query.field("foo").equalsValue(y))
.However, grouping queries currently use the
QueryToKeyMatcher
to determine if the query can be satisfied, and that tries to match the entire key, not just the grouping subkey:fdb-record-layer/fdb-record-layer-core/src/main/java/com/apple/foundationdb/record/query/QueryToKeyMatcher.java
Line 215 in 71e2842
That means that indexes with groupings are accepting grouping predicates that they shouldn't be.
The text was updated successfully, but these errors were encountered: