From b3bc7c019f23499b6aec9b0b8c4910cea042cb5a Mon Sep 17 00:00:00 2001 From: Stefan Miklosovic Date: Thu, 21 May 2026 21:53:35 +0200 Subject: [PATCH] Add get/setDataDiskUsageKeyspaceWideProtectionEnabled to GuardrailsConfig This was forgotten in the original patch. patch by Stefan Miklosovic; reviewed by Paulo Motta for CASSANDRA-21024 --- .../apache/cassandra/config/GuardrailsOptions.java | 3 ++- .../cassandra/db/guardrails/GuardrailsConfig.java | 13 +++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/java/org/apache/cassandra/config/GuardrailsOptions.java b/src/java/org/apache/cassandra/config/GuardrailsOptions.java index c166e71ec1..4fe38c4370 100644 --- a/src/java/org/apache/cassandra/config/GuardrailsOptions.java +++ b/src/java/org/apache/cassandra/config/GuardrailsOptions.java @@ -996,12 +996,13 @@ public class GuardrailsOptions implements GuardrailsConfig x -> config.data_disk_usage_percentage_fail_threshold = x); } - + @Override public boolean getDataDiskUsageKeyspaceWideProtectionEnabled() { return config.data_disk_usage_keyspace_wide_protection_enabled; } + @Override public void setDataDiskUsageKeyspaceWideProtectionEnabled(boolean enabled) { updatePropertyWithLogging("data_disk_usage_keyspace_wide_protection_enabled", diff --git a/src/java/org/apache/cassandra/db/guardrails/GuardrailsConfig.java b/src/java/org/apache/cassandra/db/guardrails/GuardrailsConfig.java index 2d893fe3f5..7467d12ef8 100644 --- a/src/java/org/apache/cassandra/db/guardrails/GuardrailsConfig.java +++ b/src/java/org/apache/cassandra/db/guardrails/GuardrailsConfig.java @@ -436,6 +436,19 @@ public interface GuardrailsConfig */ int getDataDiskUsagePercentageFailThreshold(); + /** + * @return Whether a single node replicating a given keyspace being full should block writes for the entire + * keyspace. Returns {@code true} if this behavior is enabled, {@code false} otherwise. + */ + boolean getDataDiskUsageKeyspaceWideProtectionEnabled(); + + /** + * Enables or disables blocking writes for a keyspace when any node replicating that keyspace is full. + * + * @param enabled {@code true} to block writes keyspace-wide once a replica is full, {@code false} to disable. + */ + void setDataDiskUsageKeyspaceWideProtectionEnabled(boolean enabled); + /** * @return The max disk size of the data directories when calculating disk usage thresholds, {@code null} means * disabled.