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

CNDB-10085: Add guardrail for the number of column filters per query after applying analyzers #1417

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

adelapena
Copy link

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

  • Make sure there is a PR in the CNDB project updating the Converged Cassandra version
  • Use NoSpamLogger for log lines that may appear frequently in the logs
  • Verify test results on Butler
  • Test coverage for new/modified code is > 80%
  • Proper code formatting
  • Proper title for each commit staring with the project-issue number, like CNDB-1234
  • Each commit has a meaningful description
  • Each commit is not very long and contains related changes
  • Renames, moves and reformatting are in distinct commits

@adelapena adelapena self-assigned this Nov 11, 2024
@adelapena adelapena marked this pull request as draft November 11, 2024 17:49
@adelapena adelapena marked this pull request as ready for review November 14, 2024 13:45
Copy link

sonarcloud bot commented Nov 14, 2024

@cassci-bot
Copy link

❌ Build ds-cassandra-pr-gate/PR-1417 rejected by Butler


4 new test failure(s) in 2 builds
See build details here


Found 4 new test failures

Test Explanation Branch history Upstream history
o.a.c.d.r.PendingAntiCompactionTest.testRetries regression 🔴🔵 🔵🔵🔵🔵🔵🔵🔵
...rTimeoutTest.prepareRPCTimeout[SEQUENTIAL/true] regression 🔴🔵 🔵🔵🔵🔵🔵🔵🔵
...list,wide=true,scenario=POST_BUILD_QUERY] regression 🔴🔵 🔵🔵🔵🔵🔵🔵🔵
...igint,ascii>,wide=false,scenario=SSTABLE_QUERY] regression 🔴🔵 🔵🔵🔵🔵🔵🔵🔵

Found 9 known test failures

Copy link
Collaborator

@ekaterinadimitrova2 ekaterinadimitrova2 left a 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)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// 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);
}
}
Copy link
Collaborator

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");
Copy link
Collaborator

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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// partial partition key restrictions don't count as filters
// partial partition key restrictions do count as filters

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants