-
Notifications
You must be signed in to change notification settings - Fork 22
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
CNDB-10085: Add guardrail for the number of column filters per query after applying analyzers #1417
base: main
Are you sure you want to change the base?
Conversation
…after applying analyzers
8bd292d
to
7a9af25
Compare
Quality Gate passedIssues Measures |
❌ Build ds-cassandra-pr-gate/PR-1417 rejected by Butler4 new test failure(s) in 2 builds Found 4 new test failures
Found 9 known test failures |
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.
Looks great, and I love the test coverage.
I think the only tiny tests we miss are:
- explicitly disabled guardrails have no effect
- warn threshold being higher than fail threshold
@@ -145,6 +145,10 @@ public class GuardrailsConfig | |||
public volatile Integer offset_rows_warn_threshold; | |||
public volatile Integer offset_rows_failure_threshold; | |||
|
|||
// Limit the number of column value filters per SELECT query (after applying analyzers) |
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.
// Limit the number of column value filters per SELECT query (after applying analyzers) | |
// Limit the number of column value filters per SELECT query (after applying analyzers, in case they are used) |
operations, FAIL_THRESHOLD), | ||
query); | ||
} | ||
} |
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.
nit: I think by default we leave a line at the end of every class?
|
||
config().query_filters_warn_threshold = -1; | ||
testValidationOfStrictlyPositiveProperty((c, v) -> c.query_filters_fail_threshold = v.intValue(), | ||
"query_filters_fail_threshold"); |
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.
Do you want to add a tiny test for the other validation, too? I did not find one. For the unhappy path where we set warn bigger than fail.
validateWarnLowerThanFail
assertFails("SELECT * FROM %s WHERE k1 = 0 AND k2 = 0 AND x = '1 2 3 4 5'", 5); | ||
assertFails("SELECT * FROM %s WHERE k1 = 0 AND k2 = 0 AND x = '1 2 3 4 5 6'", 6); | ||
|
||
// partial partition key restrictions don't count as filters |
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.
// partial partition key restrictions don't count as filters | |
// partial partition key restrictions do count as filters |
Adds a new
query_filters
guardrail to limit the number of column value filters per query after applying index analyzers.The guardrail is applied to the sum of all column filters, analyzed or not, indexed or not. Complete primary key restrictions are not considered column value filters so they don't count towards the configured limit.
This should be useful to limit the number of filtered columns in general, and to prevent the explosion of filtering operations produced by analyzers applied to large values.
Checklist before you submit for review
NoSpamLogger
for log lines that may appear frequently in the logs