From 073f7c36fa20e8d9410f306e57e7c7734ce74d1e Mon Sep 17 00:00:00 2001 From: Jordan West Date: Fri, 30 Dec 2022 09:20:35 -0800 Subject: [PATCH] Return empty denylist entry instead of null on failure to load Patch by Jordan West; Reviewed by Josh McKenzie for CASSANDRA-18116 --- CHANGES.txt | 1 + src/java/org/apache/cassandra/schema/PartitionDenylist.java | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index ad78142df5..3653e89ab4 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,4 +1,5 @@ 4.1.1 +* Fix perpetual load of denylist on read in cases where denylist can never be loaded (CASSANDRA-18116) Merged from 4.0: * Avoid ConcurrentModificationException in STCS/DTCS/TWCS.getSSTables (CASSANDRA-17977) * Restore internode custom tracing on 4.0's new messaging system (CASSANDRA-17981) diff --git a/src/java/org/apache/cassandra/schema/PartitionDenylist.java b/src/java/org/apache/cassandra/schema/PartitionDenylist.java index 9bd171c3b9..53fcb5e2b1 100644 --- a/src/java/org/apache/cassandra/schema/PartitionDenylist.java +++ b/src/java/org/apache/cassandra/schema/PartitionDenylist.java @@ -392,7 +392,7 @@ public class PartitionDenylist /** * Attempts to reload the DenylistEntry data from CQL for the given TableId and key count. - * @return null if we do not find the data; allows cache reloader to preserve old value + * @return empty denylist if we do not or cannot find the data, preserving the old value, otherwise the new value */ private DenylistEntry getDenylistForTableFromCQL(final TableId tid, int limit) { @@ -449,8 +449,8 @@ public class PartitionDenylist } catch (final RequestExecutionException e) { - logger.error("Error reading partition_denylist table for {}/{}. Returning empty list.", tmd.keyspace, tmd.name, e); - return null; + logger.error("Error reading partition_denylist table for {}/{}. Returning empty denylist.", tmd.keyspace, tmd.name, e); + return new DenylistEntry(); } }