josh-mckenzie commented on a change in pull request #1213:
URL: https://github.com/apache/cassandra/pull/1213#discussion_r726517072
##########
File path: src/java/org/apache/cassandra/service/StorageProxy.java
##########
@@ -1052,6 +1073,33 @@ public static void mutateWithTriggers(List<? extends
IMutation> mutations,
long queryStartNanoTime)
throws WriteTimeoutException, WriteFailureException, UnavailableException,
OverloadedException, InvalidRequestException
{
+ if (DatabaseDescriptor.enablePartitionDenylist() &&
DatabaseDescriptor.getDenylistWritesEnabled())
+ {
+ for (final IMutation mutation : mutations)
+ {
+ for (final TableId tid : mutation.getTableIds())
+ {
+ if (!partitionDenylist.isKeyPermitted(tid,
mutation.key().getKey()))
+ {
+ denylistMetrics.incrementWritesRejected();
+ final byte[] keyBytes = new
byte[mutation.key().getKey().remaining()];
+ mutation.key().getKey().slice().get(keyBytes);
+ final TableMetadata tmd =
Schema.instance.getTableMetadata(tid);
+ if (tmd != null)
+ {
+ throw new
InvalidRequestException(String.format("Unable to write to denylisted partition
[0x%s] in %s/%s",
+
Hex.bytesToHex(keyBytes), tmd.keyspace, tmd.name));
Review comment:
Changed the ones in StorageProxy, left the ones in PartitionDenylist
since it expects a ByteBuffer in the signature so needs the conversion there
from what comes into the API. Assuming original implementation was just
consistency between PartitionDenylist.java's first impl and those added usage.
Agree that this is better.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]