-
Notifications
You must be signed in to change notification settings - Fork 3.8k
CASSANDRA-21139 - Feature/guardrail for misprepare statements #4596
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
base: trunk
Are you sure you want to change the base?
Changes from all commits
d5da19a
33c3219
ae61b88
c83bf22
ba80e42
4caf9ad
e282987
5825094
50ec499
564a99d
e2071d1
0304d23
029259d
739ff86
7270f91
586af83
6dbbc90
8a70ced
5570c30
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -409,7 +409,21 @@ public void validate(ClientState state) throws InvalidRequestException | |
| checkFalse(isVirtual() && hasConditions(), "Conditional updates are not supported by virtual tables"); | ||
|
|
||
| if (attrs.isTimestampSet()) | ||
| { | ||
| Guardrails.userTimestampsEnabled.ensureEnabled(state); | ||
| } | ||
| // Misprepare guardrail shouldn't block system keyspaces | ||
| if (SchemaConstants.isSystemKeyspace(metadata.keyspace)) | ||
| return; | ||
|
|
||
| boolean hasRestriction = restrictions != null && | ||
| restrictions.hasPartitionKeyRestrictions() || | ||
| restrictions.hasClusteringColumnsRestrictions() || | ||
| restrictions.hasNonPrimaryKeyRestrictions(); | ||
| if (getBindVariables().isEmpty() && hasRestriction) | ||
| { | ||
| Guardrails.onMisprepared(state); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would rather just copy the content of that mehod here instead of having completely arbitrary method in Guardrails. There is no precedent to that. You might also move it to superclass of these Statement classes so both can call it.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. here warn is a protected function, can't write it inside statement classes or interface, not sure where else to put it. |
||
| } | ||
| } | ||
|
|
||
| public void validateDiskUsage(QueryOptions options, ClientState state) | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.