This is an automated email from the ASF dual-hosted git repository. smiklosovic pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/cassandra.git
commit c7f0a428f6dfcfc9305e3357605e7b4279e0051f Merge: daacccebd8 bdfa317387 Author: Stefan Miklosovic <[email protected]> AuthorDate: Mon Sep 21 11:14:33 2026 +0200 Merge branch 'cassandra-6.0' into trunk * cassandra-6.0: Implement Zstd compression level guardrail Fix Compression dictionary distribution silently leaving a node on a stale dictionary Fix ZstdCompressionDictionary reference leak when opening dictionary-compressed SSTables concurrently Avoid ZstdDictionary to allocate a native zstd context per chunk Avoid ZstdDictionaryCompressor to allocate a native zstd context per chunk CHANGES.txt | 5 + conf/cassandra.yaml | 8 + conf/cassandra_latest.yaml | 8 + src/java/org/apache/cassandra/config/Config.java | 3 + .../apache/cassandra/config/GuardrailsOptions.java | 27 +++ .../statements/schema/AlterSchemaStatement.java | 13 ++ .../statements/schema/AlterTableStatement.java | 1 + .../cql3/statements/schema/CopyTableStatement.java | 1 + .../statements/schema/CreateTableStatement.java | 1 + .../org/apache/cassandra/db/ColumnFamilyStore.java | 6 +- .../db/compression/CompressionDictionary.java | 5 +- .../db/compression/CompressionDictionaryCache.java | 9 +- .../CompressionDictionaryEventHandler.java | 10 + .../compression/CompressionDictionaryManager.java | 4 +- .../compression/ICompressionDictionaryCache.java | 9 +- .../db/compression/ZstdCompressionDictionary.java | 122 +++++++++++- .../apache/cassandra/db/guardrails/Guardrails.java | 30 ++- .../cassandra/db/guardrails/GuardrailsConfig.java | 18 ++ .../cassandra/db/guardrails/GuardrailsMBean.java | 16 ++ .../cassandra/io/compress/ZstdCompressorBase.java | 142 ++++++++++++-- .../io/compress/ZstdDictionaryCompressor.java | 88 +++++++-- .../schema/SystemDistributedKeyspace.java | 29 ++- .../CompressionDictionaryCacheTest.java | 91 +++++++++ .../GuardrailZstdCompressionLevelTest.java | 179 +++++++++++++++++ .../cassandra/io/compress/ZstdCompressorTest.java | 214 +++++++++++++++++++++ .../io/compress/ZstdDictionaryCompressorTest.java | 39 ++++ ...stributedKeyspaceCompressionDictionaryTest.java | 31 +++ .../nodetool/GuardrailsConfigCommandsTest.java | 7 +- 28 files changed, 1063 insertions(+), 53 deletions(-) diff --cc CHANGES.txt index 80c993b331,21285d1971..13dd374ed7 --- a/CHANGES.txt +++ b/CHANGES.txt @@@ -1,16 -1,9 +1,21 @@@ -6.0-alpha3 +7.0 + * Redact hash and _hash suffixed parameters in system_views.settings (CASSANDRA-21686) + * Allow CQLSSTableWriter to specify SSTable id generator to use (CASSANDRA-21012) + * Reject LIKE patterns with a wildcard (%) anywhere other than the start or end (CASSANDRA-21068) + * Support pluggable default role initialization (CASSANDRA-21546) + * Add prepared statement cache stats to nodetool info (CASSANDRA-14366) + * Don't increment client metrics on messaging service connection unpause (CASSANDRA-21491) + * Add nodetool getreplicas (CASSANDRA-17665) + * Implementation of CEP-49: Hardware-accelerated compression (CASSANDRA-20975) + * Avoid using ObjectUtils.getFirstNonNull in Schema (CASSANDRA-21394) + * Allow nodetool garbagecollect to take a user defined list of SSTables (CASSANDRA-16767) + * Add a guardrail for misprepared statements (CASSANDRA-21139) +Merged from 6.0: + * Implement Zstd compression level guardrail (CASSANDRA-21021) + * Fix Compression dictionary distribution silently leaving a node on a stale dictionary (CASSANDRA-21681) + * ZstdCompressionDictionary reference leak when opening dictionary-compressed SSTables concurrently (CASSANDRA-21680) + * Avoid ZstdDictionary to allocate a native zstd context per chunk (CASSANDRA-21677) + * Avoid ZstdDictionaryCompressor to allocate a native zstd context per chunk (CASSANDRA-21672) * Don't replicate transformations to LEFT nodes (CASSANDRA-21652) * Don't fail host specific repairs against system_cluster_metadata (CASSANDRA-21651) * During major upgrade, if a node has replacement arguments it attempts to bootstrap even if already bootstrapped (CASSANDRA-21634) diff --cc src/java/org/apache/cassandra/db/guardrails/Guardrails.java index d2b7fe8a63,56dc177534..a147c7988c --- a/src/java/org/apache/cassandra/db/guardrails/Guardrails.java +++ b/src/java/org/apache/cassandra/db/guardrails/Guardrails.java @@@ -727,9 -727,16 +727,19 @@@ public final class Guardrails implement state -> CONFIG_PROVIDER.getOrCreate(state).getUnsetTrainingMinFrequencyEnabled(), "unset minimum frequency of training for dictionary compressor"); + public static final PreparedStatementParameterRequirementGuardrail preparedStatementsRequireParameters = + new PreparedStatementParameterRequirementGuardrail(); + + public static final MaxThreshold zstdCompressionLevelThreshold = + new MaxThreshold("zstd_compression_level", + "Higher Zstd compression levels have detrimental " + + "effects on CPU and memory usage while yielding almost no improvement on compression ratio.", + state -> CONFIG_PROVIDER.getOrCreate(state).getZstdCompressionLevelWarnThreshold(), + state -> CONFIG_PROVIDER.getOrCreate(state).getZstdCompressionLevelFailThreshold(), + (isWarning, what, value, threshold) -> + format("Value of Zstd compression level is '%s', this exceeds the %s threshold of %s.", + value, isWarning ? "warning" : "failure", threshold)); + private Guardrails() { MBeanWrapper.instance.registerMBean(this, MBEAN_NAME); @@@ -1974,30 -1981,24 +1984,48 @@@ } } + @Override + public boolean getPreparedStatementsRequireParametersWarned() + { + return DEFAULT_CONFIG.getPreparedStatementsRequireParametersWarned(); + } + + @Override + public boolean getPreparedStatementsRequireParametersEnabled() + { + return DEFAULT_CONFIG.getPreparedStatementsRequireParametersEnabled(); + } + + @Override + public void setPreparedStatementsRequireParametersWarned(boolean warned) + { + DEFAULT_CONFIG.setPreparedStatementsRequireParametersWarned(warned); + } + + @Override + public void setPreparedStatementsRequireParametersEnabled(boolean enabled) + { + DEFAULT_CONFIG.setPreparedStatementsRequireParametersEnabled(enabled); + } + + @Override + public int getZstdCompressionLevelWarnThreshold() + { + return DEFAULT_CONFIG.getZstdCompressionLevelWarnThreshold(); + } + + @Override + public int getZstdCompressionLevelFailThreshold() + { + return DEFAULT_CONFIG.getZstdCompressionLevelFailThreshold(); + } + + @Override + public void setZstdCompressionLevelThreshold(int warn, int fail) + { + DEFAULT_CONFIG.setZstdCompressionLevelThreshold(warn, fail); + } + private static String toCSV(Set<String> values) { return values == null || values.isEmpty() ? "" : String.join(",", values); diff --cc src/java/org/apache/cassandra/db/guardrails/GuardrailsConfig.java index 577acd111e,35ec93f242..5db02dd69b --- a/src/java/org/apache/cassandra/db/guardrails/GuardrailsConfig.java +++ b/src/java/org/apache/cassandra/db/guardrails/GuardrailsConfig.java @@@ -732,29 -732,21 +732,47 @@@ public interface GuardrailsConfi */ Map<String, String> getMinimumClientDriverVersionsDisallowed(); + /** + * @return {@code true} if a warning is logged when a prepared statement is created without parameters, + * {@code false} otherwise. + */ + boolean getPreparedStatementsRequireParametersWarned(); + + /** + * @return {@code true} if creating a prepared statement without parameters is rejected, + * {@code false} otherwise. + */ + boolean getPreparedStatementsRequireParametersEnabled(); + + /** + * Sets whether to log a warning when a prepared statement is created without parameters. + * + * @param warned {@code true} to enable the warning, {@code false} to disable it. + */ + void setPreparedStatementsRequireParametersWarned(boolean warned); + + /** + * Sets whether to reject creating a prepared statement without parameters. + * + * @param enabled {@code true} to reject, {@code false} to allow. + */ + void setPreparedStatementsRequireParametersEnabled(boolean enabled); ++ + /** + * @return the warning threshold for the Zstd compressor level + */ + int getZstdCompressionLevelWarnThreshold(); + + /** + * @return the failure threshold for the Zstd compressor level + */ + int getZstdCompressionLevelFailThreshold(); + + /** + * Sets warning and failure thresholds for the Zstd compressor levels. + * + * @param warn value to set for warn threshold + * @param fail value to set for fail threshold + */ + void setZstdCompressionLevelThreshold(int warn, int fail); } diff --cc src/java/org/apache/cassandra/db/guardrails/GuardrailsMBean.java index fc6eb79799,93a14c6800..7e7d3424f0 --- a/src/java/org/apache/cassandra/db/guardrails/GuardrailsMBean.java +++ b/src/java/org/apache/cassandra/db/guardrails/GuardrailsMBean.java @@@ -1250,29 -1250,19 +1250,45 @@@ public interface GuardrailsMBea */ void setMinimumClientDriverVersionsDisallowed(String value); + /** + * @return {@code true} if a warning is logged when a prepared statement is created without parameters, + * {@code false} otherwise. + */ + boolean getPreparedStatementsRequireParametersWarned(); + + /** + * @return {@code true} if creating a prepared statement without parameters is rejected, + * {@code false} otherwise. + */ + boolean getPreparedStatementsRequireParametersEnabled(); + + /** + * Sets whether to log a warning when a prepared statement is created without parameters. + * + * @param warned {@code true} to enable the warning, {@code false} to disable it. + */ + void setPreparedStatementsRequireParametersWarned(boolean warned); + + /** + * Sets whether to reject creating a prepared statement without parameters. + * + * @param enabled {@code true} to reject, {@code false} to allow. + */ + void setPreparedStatementsRequireParametersEnabled(boolean enabled); ++ + /** + * @return The threshold to warn when creating a table with a Zstd compression level above it. + */ + int getZstdCompressionLevelWarnThreshold(); + + /** + * @return The threshold to fail when creating a table with a Zstd compression level above it. + */ + int getZstdCompressionLevelFailThreshold(); + + /** + * @param warn The threshold to warn when creating a table with a Zstd compression level above it. -1 means disabled. + * @param fail The threshold to prevent creating a table with a Zstd compression level above it. -1 means disabled. + */ + void setZstdCompressionLevelThreshold(int warn, int fail); } --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
