-
Notifications
You must be signed in to change notification settings - Fork 3.8k
CASSANDRA-20892: Don't allow JMX operations for denylist when denylist is disabled #4366
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
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 |
|---|---|---|
|
|
@@ -3637,9 +3637,16 @@ public void initialLoadPartitionDenylist() | |
| @Override | ||
| public void loadPartitionDenylist() | ||
| { | ||
| checkPartitionDenylistEnabled(); | ||
| partitionDenylist.load(); | ||
| } | ||
|
|
||
| @Override | ||
| public boolean getPartitionDenylistEnabled() | ||
| { | ||
| return DatabaseDescriptor.getPartitionDenylistEnabled(); | ||
| } | ||
|
|
||
| @Override | ||
| public int getPartitionDenylistLoadAttempts() | ||
| { | ||
|
|
@@ -3698,6 +3705,7 @@ public void setDenylistMaxKeysTotal(int value) | |
| @Override | ||
| public boolean denylistKey(String keyspace, String table, String partitionKeyAsString) | ||
| { | ||
| checkPartitionDenylistEnabled(); | ||
| if (!Schema.instance.getKeyspaces().contains(keyspace)) | ||
| return false; | ||
|
|
||
|
|
@@ -3719,6 +3727,7 @@ public boolean denylistKey(String keyspace, String table, String partitionKeyAsS | |
| @Override | ||
| public boolean removeDenylistKey(String keyspace, String table, String partitionKeyAsString) | ||
| { | ||
| checkPartitionDenylistEnabled(); | ||
| if (!Schema.instance.getKeyspaces().contains(keyspace)) | ||
| return false; | ||
|
|
||
|
|
@@ -3735,6 +3744,7 @@ public boolean removeDenylistKey(String keyspace, String table, String partition | |
| */ | ||
| public boolean isKeyDenylisted(String keyspace, String table, String partitionKeyAsString) | ||
| { | ||
| checkPartitionDenylistEnabled(); | ||
| if (!Schema.instance.getKeyspaces().contains(keyspace)) | ||
| return false; | ||
|
|
||
|
|
@@ -3746,6 +3756,12 @@ public boolean isKeyDenylisted(String keyspace, String table, String partitionKe | |
| return !partitionDenylist.isKeyPermitted(keyspace, table, bytes); | ||
| } | ||
|
|
||
| private void checkPartitionDenylistEnabled() { | ||
|
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 rename it to |
||
| if (!getPartitionDenylistEnabled()) { | ||
|
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. braces for one line is not necessary |
||
| throw new UnsupportedOperationException("Denylisting partitions is disabled"); | ||
|
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 am not sure this is the most appropriate one. This looks like the code is not there yet. |
||
| } | ||
| } | ||
|
|
||
| @Override | ||
| public void logBlockingReadRepairAttemptsForNSeconds(int seconds) | ||
| { | ||
|
|
||
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.
braces on new line