This is an automated email from the ASF dual-hosted git repository. edimitrova pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/cassandra.git
commit a3258d66bcc9f946304c19d59e75d2721126303e Author: Ekaterina Dimitrova <ekaterina.dimitr...@datastax.com> AuthorDate: Tue Feb 1 17:14:17 2022 -0500 Transfer parameters to the newly introduced configuration framework (1) patch by Ekaterina Dimitrova; reviewed by Caleb Rackliffe, David Capwell, Michael Semb Wever and Benjamin Lerer for CASSANDRA-15234 --- conf/cassandra.yaml | 20 +++++------ pylib/cassandra-cqlsh-tests.sh | 4 +-- src/java/org/apache/cassandra/config/Config.java | 33 +++++++++++------ .../cassandra/config/DatabaseDescriptor.java | 40 ++++++++++----------- .../apache/cassandra/config/EncryptionOptions.java | 41 +++++++++++----------- .../cassandra/cql3/functions/UDFunction.java | 4 +-- .../statements/schema/CreateIndexStatement.java | 2 +- .../statements/schema/CreateViewStatement.java | 2 +- .../apache/cassandra/db/virtual/SettingsTable.java | 2 +- .../org/apache/cassandra/net/InboundSockets.java | 2 +- .../apache/cassandra/net/OutboundConnection.java | 2 +- test/conf/cassandra-murmur.yaml | 8 ++--- test/conf/cassandra-seeds.yaml | 4 +-- ...dra-sslcontextfactory-invalidconfiguration.yaml | 8 ++--- test/conf/cassandra-sslcontextfactory.yaml | 8 ++--- test/conf/cassandra.yaml | 8 ++--- test/conf/unit-test-conf/test-native-port.yaml | 4 +-- .../cassandra/distributed/test/CountersTest.java | 2 +- .../cassandra/distributed/test/GroupByTest.java | 6 ++-- .../test/InternodeEncryptionOptionsTest.java | 6 ++-- .../upgrade/CompactStorageUpgradeTest.java | 2 +- .../LoadOldYAMLBackwardCompatibilityTest.java | 17 +++++---- test/unit/org/apache/cassandra/cql3/ViewTest.java | 6 ++-- .../apache/cassandra/index/sasi/SASICQLTest.java | 6 ++-- .../apache/cassandra/net/MessagingServiceTest.java | 4 +-- 25 files changed, 128 insertions(+), 113 deletions(-) diff --git a/conf/cassandra.yaml b/conf/cassandra.yaml index 8741b9b..265bf38 100644 --- a/conf/cassandra.yaml +++ b/conf/cassandra.yaml @@ -1059,7 +1059,7 @@ slow_query_log_timeout_in_ms: 500 # # Warning: It is generally assumed that users have setup NTP on their clusters, and that clocks are modestly in sync, # since this is a requirement for general correctness of last write wins. -#cross_node_timeout: true +# internode_timeout: true # Set keep-alive period for streaming # This node will send a keep-alive message periodically with this period. @@ -1225,7 +1225,7 @@ server_encryption_options: # optional: true # If enabled, will open up an encrypted listening socket on ssl_storage_port. Should only be used # during upgrade to 4.0; otherwise, set to false. - enable_legacy_ssl_storage_port: false + legacy_ssl_storage_port_enabled: false # Set to a valid keystore if internode_encryption is dc, rack or all keystore: conf/.keystore keystore_password: cassandra @@ -1311,13 +1311,13 @@ tracetype_repair_ttl: 604800 # INFO level # UDFs (user defined functions) are disabled by default. # As of Cassandra 3.0 there is a sandbox in place that should prevent execution of evil code. -enable_user_defined_functions: false +user_defined_functions_enabled: false # Enables scripted UDFs (JavaScript UDFs). -# Java UDFs are always enabled, if enable_user_defined_functions is true. +# Java UDFs are always enabled, if user_defined_functions_enabled is true. # Enable this option to be able to use UDFs with "language javascript" or any custom JSR-223 provider. -# This option has no effect, if enable_user_defined_functions is false. -enable_scripted_user_defined_functions: false +# This option has no effect, if user_defined_functions_enabled is false. +scripted_user_defined_functions_enabled: false # Enables encrypting data at-rest (on disk). Different key providers can be plugged in, but the default reads from # a JCE-style keystore. A single keystore can hold multiple keys, but the one referenced by @@ -1528,19 +1528,19 @@ report_unconfirmed_repaired_data_mismatches: false # Enables materialized view creation on this node. # Materialized views are considered experimental and are not recommended for production use. -enable_materialized_views: false +materialized_views_enabled: false # Enables SASI index creation on this node. # SASI indexes are considered experimental and are not recommended for production use. -enable_sasi_indexes: false +sasi_indexes_enabled: false # Enables creation of transiently replicated keyspaces on this node. # Transient replication is experimental and is not recommended for production use. -enable_transient_replication: false +transient_replication_enabled: false # Enables the used of 'ALTER ... DROP COMPACT STORAGE' statements on this node. # 'ALTER ... DROP COMPACT STORAGE' is considered experimental and is not recommended for production use. -enable_drop_compact_storage: false +drop_compact_storage_enabled: false # Whether or not USE <keyspace> is allowed. This is enabled by default to avoid failure on upgrade. #use_statements_enabled: true diff --git a/pylib/cassandra-cqlsh-tests.sh b/pylib/cassandra-cqlsh-tests.sh index 7904166..b147194 100755 --- a/pylib/cassandra-cqlsh-tests.sh +++ b/pylib/cassandra-cqlsh-tests.sh @@ -101,8 +101,8 @@ fi ccm remove test || true # in case an old ccm cluster is left behind ccm create test -n 1 --install-dir=${CASSANDRA_DIR} -ccm updateconf "enable_user_defined_functions: true" -ccm updateconf "enable_scripted_user_defined_functions: true" +ccm updateconf "user_defined_functions_enabled: true" +ccm updateconf "scripted_user_defined_functions_enabled: true" version_from_build=$(ccm node1 versionfrombuild) export pre_or_post_cdc=$(python -c """from distutils.version import LooseVersion diff --git a/src/java/org/apache/cassandra/config/Config.java b/src/java/org/apache/cassandra/config/Config.java index 4f6e27e..0485cc1 100644 --- a/src/java/org/apache/cassandra/config/Config.java +++ b/src/java/org/apache/cassandra/config/Config.java @@ -114,7 +114,8 @@ public class Config public Integer streaming_connections_per_host = 1; public Integer streaming_keep_alive_period_in_secs = 300; //5 minutes - public boolean cross_node_timeout = true; + @Replaces(oldName = "cross_node_timeout", converter = Converters.IDENTITY, deprecated = true) + public boolean internode_timeout = true; public volatile long slow_query_log_timeout_in_ms = 500L; @@ -401,16 +402,22 @@ public class Config */ public Long prepared_statements_cache_size_mb = null; - public boolean enable_user_defined_functions = false; - public boolean enable_scripted_user_defined_functions = false; + @Replaces(oldName = "enable_user_defined_functions", converter = Converters.IDENTITY, deprecated = true) + public boolean user_defined_functions_enabled = false; + @Replaces(oldName = "enable_scripted_user_defined_functions", converter = Converters.IDENTITY, deprecated = true) + public boolean scripted_user_defined_functions_enabled = false; - public boolean enable_materialized_views = false; + @Replaces(oldName = "enable_materialized_views", converter = Converters.IDENTITY, deprecated = true) + public boolean materialized_views_enabled = false; - public boolean enable_transient_replication = false; + @Replaces(oldName = "enable_transient_replication", converter = Converters.IDENTITY, deprecated = true) + public boolean transient_replication_enabled = false; - public boolean enable_sasi_indexes = false; + @Replaces(oldName = "enable_sasi_indexes", converter = Converters.IDENTITY, deprecated = true) + public boolean sasi_indexes_enabled = false; - public volatile boolean enable_drop_compact_storage = false; + @Replaces(oldName = "enable_drop_compact_storage", converter = Converters.IDENTITY, deprecated = true) + public volatile boolean drop_compact_storage_enabled = false; public volatile boolean use_statements_enabled = true; @@ -423,17 +430,21 @@ public class Config * When you disable async UDF execution, users MUST pay attention to read-timeouts since these may indicate * UDFs that run too long or forever - and this can destabilize the cluster. */ - public boolean enable_user_defined_functions_threads = true; + // Below parameter is not presented in cassandra.yaml but to be on the safe side that no one was directly using it + // I still added backward compatibility (CASSANDRA-15234) + @Replaces(oldName = "enable_user_defined_functions_threads", converter = Converters.IDENTITY, deprecated = true) + public boolean user_defined_functions_threads_enabled = true; /** * Time in milliseconds after a warning will be emitted to the log and to the client that a UDF runs too long. - * (Only valid, if enable_user_defined_functions_threads==true) + * (Only valid, if user_defined_functions_threads_enabled==true) */ public long user_defined_function_warn_timeout = 500; /** * Time in milliseconds after a fatal UDF run-time situation is detected and action according to * user_function_timeout_policy will take place. - * (Only valid, if enable_user_defined_functions_threads==true) + * (Only valid, if user_defined_functions_threads_enabled==true) */ + //No need of unit conversion as this parameter is not exposed in the yaml file public long user_defined_function_fail_timeout = 1500; /** * Defines what to do when a UDF ran longer than user_defined_function_fail_timeout. @@ -441,7 +452,7 @@ public class Config * - 'die' - i.e. it is able to emit a warning to the client before the Cassandra Daemon will shut down. * - 'die_immediate' - shut down C* daemon immediately (effectively prevent the chance that the client will receive a warning). * - 'ignore' - just log - the most dangerous option. - * (Only valid, if enable_user_defined_functions_threads==true) + * (Only valid, if user_defined_functions_threads_enabled==true) */ public UserFunctionTimeoutPolicy user_function_timeout_policy = UserFunctionTimeoutPolicy.die; diff --git a/src/java/org/apache/cassandra/config/DatabaseDescriptor.java b/src/java/org/apache/cassandra/config/DatabaseDescriptor.java index 021b0c6..622a825 100644 --- a/src/java/org/apache/cassandra/config/DatabaseDescriptor.java +++ b/src/java/org/apache/cassandra/config/DatabaseDescriptor.java @@ -790,10 +790,10 @@ public class DatabaseDescriptor { conf.server_encryption_options.applyConfig(); - if (conf.server_encryption_options.enable_legacy_ssl_storage_port && + if (conf.server_encryption_options.legacy_ssl_storage_port_enabled && conf.server_encryption_options.tlsEncryptionPolicy() == EncryptionOptions.TlsEncryptionPolicy.UNENCRYPTED) { - throw new ConfigurationException("enable_legacy_ssl_storage_port is true (enabled) with internode encryption disabled (none). Enable encryption or disable the legacy ssl storage port."); + throw new ConfigurationException("legacy_ssl_storage_port_enabled is true (enabled) with internode encryption disabled (none). Enable encryption or disable the legacy ssl storage port."); } } Integer maxMessageSize = conf.internode_max_message_size_in_bytes; @@ -1724,12 +1724,12 @@ public class DatabaseDescriptor public static boolean hasCrossNodeTimeout() { - return conf.cross_node_timeout; + return conf.internode_timeout; } public static void setCrossNodeTimeout(boolean crossNodeTimeout) { - conf.cross_node_timeout = crossNodeTimeout; + conf.internode_timeout = crossNodeTimeout; } public static long getSlowQueryTimeout(TimeUnit units) @@ -3074,22 +3074,22 @@ public class DatabaseDescriptor public static boolean enableUserDefinedFunctions() { - return conf.enable_user_defined_functions; + return conf.user_defined_functions_enabled; } public static boolean enableScriptedUserDefinedFunctions() { - return conf.enable_scripted_user_defined_functions; + return conf.scripted_user_defined_functions_enabled; } public static void enableScriptedUserDefinedFunctions(boolean enableScriptedUserDefinedFunctions) { - conf.enable_scripted_user_defined_functions = enableScriptedUserDefinedFunctions; + conf.scripted_user_defined_functions_enabled = enableScriptedUserDefinedFunctions; } public static boolean enableUserDefinedFunctionsThreads() { - return conf.enable_user_defined_functions_threads; + return conf.user_defined_functions_threads_enabled; } public static long getUserDefinedFunctionWarnTimeout() @@ -3102,45 +3102,45 @@ public class DatabaseDescriptor conf.user_defined_function_warn_timeout = userDefinedFunctionWarnTimeout; } - public static boolean getEnableMaterializedViews() + public static boolean getMaterializedViewsEnabled() { - return conf.enable_materialized_views; + return conf.materialized_views_enabled; } - public static void setEnableMaterializedViews(boolean enableMaterializedViews) + public static void setMaterializedViewsEnabled(boolean enableMaterializedViews) { - conf.enable_materialized_views = enableMaterializedViews; + conf.materialized_views_enabled = enableMaterializedViews; } - public static boolean getEnableSASIIndexes() + public static boolean getSASIIndexesEnabled() { - return conf.enable_sasi_indexes; + return conf.sasi_indexes_enabled; } - public static void setEnableSASIIndexes(boolean enableSASIIndexes) + public static void setSASIIndexesEnabled(boolean enableSASIIndexes) { - conf.enable_sasi_indexes = enableSASIIndexes; + conf.sasi_indexes_enabled = enableSASIIndexes; } public static boolean isTransientReplicationEnabled() { - return conf.enable_transient_replication; + return conf.transient_replication_enabled; } public static void setTransientReplicationEnabledUnsafe(boolean enabled) { - conf.enable_transient_replication = enabled; + conf.transient_replication_enabled = enabled; } public static boolean enableDropCompactStorage() { - return conf.enable_drop_compact_storage; + return conf.drop_compact_storage_enabled; } @VisibleForTesting public static void setEnableDropCompactStorage(boolean enableDropCompactStorage) { - conf.enable_drop_compact_storage = enableDropCompactStorage; + conf.drop_compact_storage_enabled = enableDropCompactStorage; } public static long getUserDefinedFunctionFailTimeout() diff --git a/src/java/org/apache/cassandra/config/EncryptionOptions.java b/src/java/org/apache/cassandra/config/EncryptionOptions.java index 616d344..6c26e8d 100644 --- a/src/java/org/apache/cassandra/config/EncryptionOptions.java +++ b/src/java/org/apache/cassandra/config/EncryptionOptions.java @@ -579,12 +579,13 @@ public class EncryptionOptions } public final InternodeEncryption internode_encryption; - public final boolean enable_legacy_ssl_storage_port; + @Replaces(oldName = "enable_legacy_ssl_storage_port", deprecated = true) + public final boolean legacy_ssl_storage_port_enabled; public ServerEncryptionOptions() { this.internode_encryption = InternodeEncryption.none; - this.enable_legacy_ssl_storage_port = false; + this.legacy_ssl_storage_port_enabled = false; } public ServerEncryptionOptions(ParameterizedClass sslContextFactoryClass, String keystore, @@ -592,20 +593,20 @@ public class EncryptionOptions List<String> cipher_suites, String protocol, List<String> accepted_protocols, String algorithm, String store_type, boolean require_client_auth, boolean require_endpoint_verification, Boolean optional, - InternodeEncryption internode_encryption, boolean enable_legacy_ssl_storage_port) + InternodeEncryption internode_encryption, boolean legacy_ssl_storage_port_enabled) { super(sslContextFactoryClass, keystore, keystore_password, truststore, truststore_password, cipher_suites, protocol, accepted_protocols, algorithm, store_type, require_client_auth, require_endpoint_verification, null, optional); this.internode_encryption = internode_encryption; - this.enable_legacy_ssl_storage_port = enable_legacy_ssl_storage_port; + this.legacy_ssl_storage_port_enabled = legacy_ssl_storage_port_enabled; } public ServerEncryptionOptions(ServerEncryptionOptions options) { super(options); this.internode_encryption = options.internode_encryption; - this.enable_legacy_ssl_storage_port = options.enable_legacy_ssl_storage_port; + this.legacy_ssl_storage_port_enabled = options.legacy_ssl_storage_port_enabled; } @Override @@ -680,7 +681,7 @@ public class EncryptionOptions truststore_password, cipher_suites, protocol, accepted_protocols, algorithm, store_type, require_client_auth, require_endpoint_verification, optional, internode_encryption, - enable_legacy_ssl_storage_port).applyConfigInternal(); + legacy_ssl_storage_port_enabled).applyConfigInternal(); } public ServerEncryptionOptions withKeyStore(String keystore) @@ -689,7 +690,7 @@ public class EncryptionOptions truststore_password, cipher_suites, protocol, accepted_protocols, algorithm, store_type, require_client_auth, require_endpoint_verification, optional, internode_encryption, - enable_legacy_ssl_storage_port).applyConfigInternal(); + legacy_ssl_storage_port_enabled).applyConfigInternal(); } public ServerEncryptionOptions withKeyStorePassword(String keystore_password) @@ -698,7 +699,7 @@ public class EncryptionOptions truststore_password, cipher_suites, protocol, accepted_protocols, algorithm, store_type, require_client_auth, require_endpoint_verification, optional, internode_encryption, - enable_legacy_ssl_storage_port).applyConfigInternal(); + legacy_ssl_storage_port_enabled).applyConfigInternal(); } public ServerEncryptionOptions withTrustStore(String truststore) @@ -707,7 +708,7 @@ public class EncryptionOptions truststore_password, cipher_suites, protocol, accepted_protocols, algorithm, store_type, require_client_auth, require_endpoint_verification, optional, internode_encryption, - enable_legacy_ssl_storage_port).applyConfigInternal(); + legacy_ssl_storage_port_enabled).applyConfigInternal(); } public ServerEncryptionOptions withTrustStorePassword(String truststore_password) @@ -716,7 +717,7 @@ public class EncryptionOptions truststore_password, cipher_suites, protocol, accepted_protocols, algorithm, store_type, require_client_auth, require_endpoint_verification, optional, internode_encryption, - enable_legacy_ssl_storage_port).applyConfigInternal(); + legacy_ssl_storage_port_enabled).applyConfigInternal(); } public ServerEncryptionOptions withCipherSuites(List<String> cipher_suites) @@ -725,7 +726,7 @@ public class EncryptionOptions truststore_password, cipher_suites, protocol, accepted_protocols, algorithm, store_type, require_client_auth, require_endpoint_verification, optional, internode_encryption, - enable_legacy_ssl_storage_port).applyConfigInternal(); + legacy_ssl_storage_port_enabled).applyConfigInternal(); } public ServerEncryptionOptions withCipherSuites(String ... cipher_suites) @@ -734,7 +735,7 @@ public class EncryptionOptions truststore_password, Arrays.asList(cipher_suites), protocol, accepted_protocols, algorithm, store_type, require_client_auth, require_endpoint_verification, optional, internode_encryption, - enable_legacy_ssl_storage_port).applyConfigInternal(); + legacy_ssl_storage_port_enabled).applyConfigInternal(); } public ServerEncryptionOptions withProtocol(String protocol) @@ -743,7 +744,7 @@ public class EncryptionOptions truststore_password, cipher_suites, protocol, accepted_protocols, algorithm, store_type, require_client_auth, require_endpoint_verification, optional, internode_encryption, - enable_legacy_ssl_storage_port).applyConfigInternal(); + legacy_ssl_storage_port_enabled).applyConfigInternal(); } public ServerEncryptionOptions withAcceptedProtocols(List<String> accepted_protocols) @@ -752,7 +753,7 @@ public class EncryptionOptions truststore_password, cipher_suites, protocol, accepted_protocols, algorithm, store_type, require_client_auth, require_endpoint_verification, optional, internode_encryption, - enable_legacy_ssl_storage_port).applyConfigInternal(); + legacy_ssl_storage_port_enabled).applyConfigInternal(); } public ServerEncryptionOptions withAlgorithm(String algorithm) @@ -761,7 +762,7 @@ public class EncryptionOptions truststore_password, cipher_suites, protocol, accepted_protocols, algorithm, store_type, require_client_auth, require_endpoint_verification, optional, internode_encryption, - enable_legacy_ssl_storage_port).applyConfigInternal(); + legacy_ssl_storage_port_enabled).applyConfigInternal(); } public ServerEncryptionOptions withStoreType(String store_type) @@ -770,7 +771,7 @@ public class EncryptionOptions truststore_password, cipher_suites, protocol, accepted_protocols, algorithm, store_type, require_client_auth, require_endpoint_verification, optional, internode_encryption, - enable_legacy_ssl_storage_port).applyConfigInternal(); + legacy_ssl_storage_port_enabled).applyConfigInternal(); } public ServerEncryptionOptions withRequireClientAuth(boolean require_client_auth) @@ -779,7 +780,7 @@ public class EncryptionOptions truststore_password, cipher_suites, protocol, accepted_protocols, algorithm, store_type, require_client_auth, require_endpoint_verification, optional, internode_encryption, - enable_legacy_ssl_storage_port).applyConfigInternal(); + legacy_ssl_storage_port_enabled).applyConfigInternal(); } public ServerEncryptionOptions withRequireEndpointVerification(boolean require_endpoint_verification) @@ -788,7 +789,7 @@ public class EncryptionOptions truststore_password, cipher_suites, protocol, accepted_protocols, algorithm, store_type, require_client_auth, require_endpoint_verification, optional, internode_encryption, - enable_legacy_ssl_storage_port).applyConfigInternal(); + legacy_ssl_storage_port_enabled).applyConfigInternal(); } public ServerEncryptionOptions withOptional(boolean optional) @@ -797,7 +798,7 @@ public class EncryptionOptions truststore_password, cipher_suites, protocol, accepted_protocols, algorithm, store_type, require_client_auth, require_endpoint_verification, optional, internode_encryption, - enable_legacy_ssl_storage_port).applyConfigInternal(); + legacy_ssl_storage_port_enabled).applyConfigInternal(); } public ServerEncryptionOptions withInternodeEncryption(InternodeEncryption internode_encryption) @@ -806,7 +807,7 @@ public class EncryptionOptions truststore_password, cipher_suites, protocol, accepted_protocols, algorithm, store_type, require_client_auth, require_endpoint_verification, optional, internode_encryption, - enable_legacy_ssl_storage_port).applyConfigInternal(); + legacy_ssl_storage_port_enabled).applyConfigInternal(); } public ServerEncryptionOptions withLegacySslStoragePort(boolean enable_legacy_ssl_storage_port) diff --git a/src/java/org/apache/cassandra/cql3/functions/UDFunction.java b/src/java/org/apache/cassandra/cql3/functions/UDFunction.java index 55a2d45..7323fec 100644 --- a/src/java/org/apache/cassandra/cql3/functions/UDFunction.java +++ b/src/java/org/apache/cassandra/cql3/functions/UDFunction.java @@ -425,9 +425,9 @@ public abstract class UDFunction extends AbstractFunction implements ScalarFunct public static void assertUdfsEnabled(String language) { if (!DatabaseDescriptor.enableUserDefinedFunctions()) - throw new InvalidRequestException("User-defined functions are disabled in cassandra.yaml - set enable_user_defined_functions=true to enable"); + throw new InvalidRequestException("User-defined functions are disabled in cassandra.yaml - set user_defined_functions_enabled=true to enable"); if (!"java".equalsIgnoreCase(language) && !DatabaseDescriptor.enableScriptedUserDefinedFunctions()) - throw new InvalidRequestException("Scripted user-defined functions are disabled in cassandra.yaml - set enable_scripted_user_defined_functions=true to enable if you are aware of the security risks"); + throw new InvalidRequestException("Scripted user-defined functions are disabled in cassandra.yaml - set scripted_user_defined_functions_enabled=true to enable if you are aware of the security risks"); } static void initializeThread() diff --git a/src/java/org/apache/cassandra/cql3/statements/schema/CreateIndexStatement.java b/src/java/org/apache/cassandra/cql3/statements/schema/CreateIndexStatement.java index ae60f24..56cc2f9 100644 --- a/src/java/org/apache/cassandra/cql3/statements/schema/CreateIndexStatement.java +++ b/src/java/org/apache/cassandra/cql3/statements/schema/CreateIndexStatement.java @@ -84,7 +84,7 @@ public final class CreateIndexStatement extends AlterSchemaStatement { attrs.validate(); - if (attrs.isCustom && attrs.customClass.equals(SASIIndex.class.getName()) && !DatabaseDescriptor.getEnableSASIIndexes()) + if (attrs.isCustom && attrs.customClass.equals(SASIIndex.class.getName()) && !DatabaseDescriptor.getSASIIndexesEnabled()) throw new InvalidRequestException("SASI indexes are disabled. Enable in cassandra.yaml to use."); KeyspaceMetadata keyspace = schema.getNullable(keyspaceName); diff --git a/src/java/org/apache/cassandra/cql3/statements/schema/CreateViewStatement.java b/src/java/org/apache/cassandra/cql3/statements/schema/CreateViewStatement.java index 26ffeee..4297d9c 100644 --- a/src/java/org/apache/cassandra/cql3/statements/schema/CreateViewStatement.java +++ b/src/java/org/apache/cassandra/cql3/statements/schema/CreateViewStatement.java @@ -111,7 +111,7 @@ public final class CreateViewStatement extends AlterSchemaStatement public Keyspaces apply(Keyspaces schema) { - if (!DatabaseDescriptor.getEnableMaterializedViews()) + if (!DatabaseDescriptor.getMaterializedViewsEnabled()) throw ire("Materialized views are disabled. Enable in cassandra.yaml to use."); /* diff --git a/src/java/org/apache/cassandra/db/virtual/SettingsTable.java b/src/java/org/apache/cassandra/db/virtual/SettingsTable.java index cc91152..fa302b0 100644 --- a/src/java/org/apache/cassandra/db/virtual/SettingsTable.java +++ b/src/java/org/apache/cassandra/db/virtual/SettingsTable.java @@ -189,7 +189,7 @@ final class SettingsTable extends AbstractVirtualTable { EncryptionOptions.ServerEncryptionOptions server = (EncryptionOptions.ServerEncryptionOptions) value; result.row(f.getName() + "_internode_encryption").column(VALUE, server.internode_encryption.toString()); - result.row(f.getName() + "_legacy_ssl_storage_port").column(VALUE, Boolean.toString(server.enable_legacy_ssl_storage_port)); + result.row(f.getName() + "_legacy_ssl_storage_port").column(VALUE, Boolean.toString(server.legacy_ssl_storage_port_enabled)); } } diff --git a/src/java/org/apache/cassandra/net/InboundSockets.java b/src/java/org/apache/cassandra/net/InboundSockets.java index 573cccb..58cd88e 100644 --- a/src/java/org/apache/cassandra/net/InboundSockets.java +++ b/src/java/org/apache/cassandra/net/InboundSockets.java @@ -217,7 +217,7 @@ class InboundSockets InboundConnectionSettings settings = template.withDefaults(); InboundConnectionSettings legacySettings = template.withLegacySslStoragePortDefaults(); - if (settings.encryption.enable_legacy_ssl_storage_port) + if (settings.encryption.legacy_ssl_storage_port_enabled) { out.add(new InboundSocket(legacySettings)); diff --git a/src/java/org/apache/cassandra/net/OutboundConnection.java b/src/java/org/apache/cassandra/net/OutboundConnection.java index c2aecb0..821521b 100644 --- a/src/java/org/apache/cassandra/net/OutboundConnection.java +++ b/src/java/org/apache/cassandra/net/OutboundConnection.java @@ -1199,7 +1199,7 @@ public class OutboundConnection * is made before the endpointToVersion table is initially constructed or out * of date (e.g. if outbound connections are established for gossip * as a result of an inbound connection) and can result in the wrong outbound - * port being selected if configured with enable_legacy_ssl_storage_port=true. + * port being selected if configured with legacy_ssl_storage_port_enabled=true. */ int knownMessagingVersion = messagingVersion(); if (knownMessagingVersion != messagingVersion) diff --git a/test/conf/cassandra-murmur.yaml b/test/conf/cassandra-murmur.yaml index 75c1917..06507e4 100644 --- a/test/conf/cassandra-murmur.yaml +++ b/test/conf/cassandra-murmur.yaml @@ -38,7 +38,7 @@ concurrent_compactors: 4 compaction_throughput: 0MiB/s row_cache_class_name: org.apache.cassandra.cache.OHCProvider row_cache_size_in_mb: 16 -enable_user_defined_functions: true -enable_scripted_user_defined_functions: true -enable_sasi_indexes: true -enable_materialized_views: true +user_defined_functions_enabled: true +scripted_user_defined_functions_enabled: true +sasi_indexes_enabled: true +materialized_views_enabled: true diff --git a/test/conf/cassandra-seeds.yaml b/test/conf/cassandra-seeds.yaml index 2673461..5e016cb 100644 --- a/test/conf/cassandra-seeds.yaml +++ b/test/conf/cassandra-seeds.yaml @@ -39,5 +39,5 @@ concurrent_compactors: 4 compaction_throughput: 0MiB/s row_cache_class_name: org.apache.cassandra.cache.OHCProvider row_cache_size_in_mb: 16 -enable_user_defined_functions: true -enable_scripted_user_defined_functions: true +user_defined_functions_enabled: true +scripted_user_defined_functions_enabled: true diff --git a/test/conf/cassandra-sslcontextfactory-invalidconfiguration.yaml b/test/conf/cassandra-sslcontextfactory-invalidconfiguration.yaml index 15a4c92..e528d27 100644 --- a/test/conf/cassandra-sslcontextfactory-invalidconfiguration.yaml +++ b/test/conf/cassandra-sslcontextfactory-invalidconfiguration.yaml @@ -71,12 +71,12 @@ concurrent_compactors: 4 compaction_throughput: 0MiB/s row_cache_class_name: org.apache.cassandra.cache.OHCProvider row_cache_size_in_mb: 16 -enable_user_defined_functions: true -enable_scripted_user_defined_functions: true +user_defined_functions_enabled: true +scripted_user_defined_functions_enabled: true prepared_statements_cache_size_mb: 1 corrupted_tombstone_strategy: exception stream_entire_sstables: true stream_throughput_outbound: 23841823841858MiB/s -enable_sasi_indexes: true -enable_materialized_views: true +sasi_indexes_enabled: true +materialized_views_enabled: true file_cache_enabled: true diff --git a/test/conf/cassandra-sslcontextfactory.yaml b/test/conf/cassandra-sslcontextfactory.yaml index 3fcb536..26cea35 100644 --- a/test/conf/cassandra-sslcontextfactory.yaml +++ b/test/conf/cassandra-sslcontextfactory.yaml @@ -74,12 +74,12 @@ concurrent_compactors: 4 compaction_throughput: 0MiB/s row_cache_class_name: org.apache.cassandra.cache.OHCProvider row_cache_size_in_mb: 16 -enable_user_defined_functions: true -enable_scripted_user_defined_functions: true +user_defined_functions_enabled: true +scripted_user_defined_functions_enabled: true prepared_statements_cache_size_mb: 1 corrupted_tombstone_strategy: exception stream_entire_sstables: true stream_throughput_outbound: 23841858MiB/s -enable_sasi_indexes: true -enable_materialized_views: true +sasi_indexes_enabled: true +materialized_views_enabled: true file_cache_enabled: true diff --git a/test/conf/cassandra.yaml b/test/conf/cassandra.yaml index 3ed919d..bd5a1b8 100644 --- a/test/conf/cassandra.yaml +++ b/test/conf/cassandra.yaml @@ -42,14 +42,14 @@ concurrent_compactors: 4 compaction_throughput: 0MiB/s row_cache_class_name: org.apache.cassandra.cache.OHCProvider row_cache_size_in_mb: 16 -enable_user_defined_functions: true -enable_scripted_user_defined_functions: true +user_defined_functions_enabled: true +scripted_user_defined_functions_enabled: true prepared_statements_cache_size_mb: 1 corrupted_tombstone_strategy: exception stream_entire_sstables: true stream_throughput_outbound: 23841858MiB/s -enable_sasi_indexes: true -enable_materialized_views: true +sasi_indexes_enabled: true +materialized_views_enabled: true enable_drop_compact_storage: true file_cache_enabled: true auto_hints_cleanup_enabled: true diff --git a/test/conf/unit-test-conf/test-native-port.yaml b/test/conf/unit-test-conf/test-native-port.yaml index 58cd383..8db2ad4 100644 --- a/test/conf/unit-test-conf/test-native-port.yaml +++ b/test/conf/unit-test-conf/test-native-port.yaml @@ -42,8 +42,8 @@ concurrent_compactors: 4 compaction_throughput_mb_per_sec: 0 row_cache_class_name: org.apache.cassandra.cache.OHCProvider row_cache_size_in_mb: 16 -enable_user_defined_functions: true -enable_scripted_user_defined_functions: true +user_defined_functions_enabled: true +scripted_user_defined_functions_enabled: true prepared_statements_cache_size_mb: 1 corrupted_tombstone_strategy: exception stream_entire_sstables: true diff --git a/test/distributed/org/apache/cassandra/distributed/test/CountersTest.java b/test/distributed/org/apache/cassandra/distributed/test/CountersTest.java index 7cc632f..29ce511 100644 --- a/test/distributed/org/apache/cassandra/distributed/test/CountersTest.java +++ b/test/distributed/org/apache/cassandra/distributed/test/CountersTest.java @@ -45,7 +45,7 @@ public class CountersTest extends TestBaseImpl private static void testUpdateCounter(boolean droppedCompactStorage) throws Throwable { - try (Cluster cluster = Cluster.build(2).withConfig(c -> c.with(GOSSIP, NATIVE_PROTOCOL).set("enable_drop_compact_storage", true)).start()) + try (Cluster cluster = Cluster.build(2).withConfig(c -> c.with(GOSSIP, NATIVE_PROTOCOL).set("drop_compact_storage_enabled", true)).start()) { cluster.schemaChange("CREATE KEYSPACE k WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1}"); diff --git a/test/distributed/org/apache/cassandra/distributed/test/GroupByTest.java b/test/distributed/org/apache/cassandra/distributed/test/GroupByTest.java index cab3fee..d75b6ba 100644 --- a/test/distributed/org/apache/cassandra/distributed/test/GroupByTest.java +++ b/test/distributed/org/apache/cassandra/distributed/test/GroupByTest.java @@ -42,7 +42,7 @@ public class GroupByTest extends TestBaseImpl @Test public void groupByWithDeletesAndSrpOnPartitions() throws Throwable { - try (Cluster cluster = init(builder().withNodes(2).withConfig((cfg) -> cfg.set("enable_user_defined_functions", "true")).start())) + try (Cluster cluster = init(builder().withNodes(2).withConfig((cfg) -> cfg.set("user_defined_functions_enabled", "true")).start())) { cluster.schemaChange(withKeyspace("CREATE TABLE %s.tbl (pk int, ck text, PRIMARY KEY (pk, ck))")); initFunctions(cluster); @@ -69,7 +69,7 @@ public class GroupByTest extends TestBaseImpl @Test public void groupByWithDeletesAndSrpOnRows() throws Throwable { - try (Cluster cluster = init(builder().withNodes(2).withConfig((cfg) -> cfg.set("enable_user_defined_functions", "true")).start())) + try (Cluster cluster = init(builder().withNodes(2).withConfig((cfg) -> cfg.set("user_defined_functions_enabled", "true")).start())) { cluster.schemaChange(withKeyspace("CREATE TABLE %s.tbl (pk int, ck text, PRIMARY KEY (pk, ck))")); initFunctions(cluster); @@ -96,7 +96,7 @@ public class GroupByTest extends TestBaseImpl @Test public void testGroupByWithAggregatesAndPaging() throws Throwable { - try (Cluster cluster = init(builder().withNodes(2).withConfig((cfg) -> cfg.set("enable_user_defined_functions", "true")).start())) + try (Cluster cluster = init(builder().withNodes(2).withConfig((cfg) -> cfg.set("user_defined_functions_enabled", "true")).start())) { cluster.schemaChange(withKeyspace("CREATE TABLE %s.tbl (pk int, ck int, v1 text, v2 text, v3 text, primary key (pk, ck))")); initFunctions(cluster); diff --git a/test/distributed/org/apache/cassandra/distributed/test/InternodeEncryptionOptionsTest.java b/test/distributed/org/apache/cassandra/distributed/test/InternodeEncryptionOptionsTest.java index 1462b03..b06f02a 100644 --- a/test/distributed/org/apache/cassandra/distributed/test/InternodeEncryptionOptionsTest.java +++ b/test/distributed/org/apache/cassandra/distributed/test/InternodeEncryptionOptionsTest.java @@ -55,7 +55,7 @@ public class InternodeEncryptionOptionsTest extends AbstractEncryptionOptionsImp ImmutableMap.builder().putAll(validKeystore) .put("internode_encryption", "none") .put("optional", false) - .put("enable_legacy_ssl_storage_port", "true") + .put("legacy_ssl_storage_port_enabled", "true") .build()); }).createWithoutStarting()) { @@ -113,7 +113,7 @@ public class InternodeEncryptionOptionsTest extends AbstractEncryptionOptionsImp ImmutableMap.builder().putAll(validKeystore) .put("internode_encryption", "none") .put("optional", true) - .put("enable_legacy_ssl_storage_port", "true") + .put("legacy_ssl_storage_port_enabled", "true") .build()); }).createWithoutStarting()) { @@ -148,7 +148,7 @@ public class InternodeEncryptionOptionsTest extends AbstractEncryptionOptionsImp ImmutableMap.builder().putAll(validKeystore) .put("internode_encryption", "none") .put("optional", true) - .put("enable_legacy_ssl_storage_port", "true") + .put("legacy_ssl_storage_port_enabled", "true") .build()); }).createWithoutStarting()) { diff --git a/test/distributed/org/apache/cassandra/distributed/upgrade/CompactStorageUpgradeTest.java b/test/distributed/org/apache/cassandra/distributed/upgrade/CompactStorageUpgradeTest.java index 9e68934..657e25e 100644 --- a/test/distributed/org/apache/cassandra/distributed/upgrade/CompactStorageUpgradeTest.java +++ b/test/distributed/org/apache/cassandra/distributed/upgrade/CompactStorageUpgradeTest.java @@ -146,7 +146,7 @@ public class CompactStorageUpgradeTest extends UpgradeTestBase .nodes(2) .nodesToUpgrade(1, 2) .upgradesFrom(v30) - .withConfig(config -> config.with(GOSSIP, NETWORK).set("enable_drop_compact_storage", true)) + .withConfig(config -> config.with(GOSSIP, NETWORK).set("drop_compact_storage_enabled", true)) .setup((cluster) -> { cluster.schemaChange("CREATE TABLE " + KEYSPACE + ".tbl (pk int, ck int, PRIMARY KEY (pk, ck)) WITH COMPACT STORAGE"); cluster.coordinator(1).execute("INSERT INTO " + KEYSPACE + ".tbl (pk, ck) VALUES (1,1)", ConsistencyLevel.ALL); diff --git a/test/unit/org/apache/cassandra/config/LoadOldYAMLBackwardCompatibilityTest.java b/test/unit/org/apache/cassandra/config/LoadOldYAMLBackwardCompatibilityTest.java index 750939f..18eaded 100644 --- a/test/unit/org/apache/cassandra/config/LoadOldYAMLBackwardCompatibilityTest.java +++ b/test/unit/org/apache/cassandra/config/LoadOldYAMLBackwardCompatibilityTest.java @@ -22,6 +22,8 @@ import org.junit.BeforeClass; import org.junit.Test; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.assertFalse; public class LoadOldYAMLBackwardCompatibilityTest { @@ -41,6 +43,7 @@ public class LoadOldYAMLBackwardCompatibilityTest /*assertEquals(5, config.internode_socket_send_buffer_size_in_bytes); assertEquals(5, config.internode_socket_receive_buffer_size_in_bytes); assertEquals(DurationSpec.inMilliseconds(10800000), config.max_hint_window); + assertEquals(DurationSpec.inHours(0), config.max_hint_window); assertEquals(DurationSpec.inMilliseconds(0), config.native_transport_idle_timeout); assertEquals(DurationSpec.inMilliseconds(10000), config.request_timeout); assertEquals(DurationSpec.inMilliseconds(5000), config.read_request_timeout); @@ -99,15 +102,15 @@ public class LoadOldYAMLBackwardCompatibilityTest assertEquals(DurationSpec.inMilliseconds(1000), config.gc_warn_threshold); assertEquals(DurationSpec.inSeconds(86400), config.trace_type_query_ttl); assertEquals(DurationSpec.inSeconds(604800), config.trace_type_repair_ttl); - assertNull(config.prepared_statements_cache_size); - assertFalse(config.user_defined_functions_enabled); - assertFalse(config.scripted_user_defined_functions_enabled); - assertFalse(config.materialized_views_enabled); + assertNull(config.prepared_statements_cache_size);*/ + assertTrue(config.user_defined_functions_enabled); + assertTrue(config.scripted_user_defined_functions_enabled); + assertTrue(config.materialized_views_enabled); assertFalse(config.transient_replication_enabled); - assertFalse(config.sasi_indexes_enabled); - assertFalse(config.drop_compact_storage_enabled); + assertTrue(config.sasi_indexes_enabled); + assertTrue(config.drop_compact_storage_enabled); assertTrue(config.user_defined_functions_threads_enabled); - assertEquals(DurationSpec.inMilliseconds(2000), config.permissions_validity); + /*assertEquals(DurationSpec.inMilliseconds(2000), config.permissions_validity); assertEquals(DurationSpec.inMilliseconds(0), config.permissions_update_interval); assertEquals(DurationSpec.inMilliseconds(2000), config.roles_validity); assertEquals(DurationSpec.inMilliseconds(0), config.roles_update_interval); diff --git a/test/unit/org/apache/cassandra/cql3/ViewTest.java b/test/unit/org/apache/cassandra/cql3/ViewTest.java index 1230eec..75efa57 100644 --- a/test/unit/org/apache/cassandra/cql3/ViewTest.java +++ b/test/unit/org/apache/cassandra/cql3/ViewTest.java @@ -508,10 +508,10 @@ public class ViewTest extends ViewAbstractTest executeNet("USE " + keyspace()); - boolean enableMaterializedViews = DatabaseDescriptor.getEnableMaterializedViews(); + boolean enableMaterializedViews = DatabaseDescriptor.getMaterializedViewsEnabled(); try { - DatabaseDescriptor.setEnableMaterializedViews(false); + DatabaseDescriptor.setMaterializedViewsEnabled(false); createView("CREATE MATERIALIZED VIEW %s AS SELECT v FROM %s WHERE k IS NOT NULL AND v IS NOT NULL PRIMARY KEY (v, k)"); Assert.fail("Should not be able to create a materialized view if they are disabled"); } @@ -523,7 +523,7 @@ public class ViewTest extends ViewAbstractTest } finally { - DatabaseDescriptor.setEnableMaterializedViews(enableMaterializedViews); + DatabaseDescriptor.setMaterializedViewsEnabled(enableMaterializedViews); } } diff --git a/test/unit/org/apache/cassandra/index/sasi/SASICQLTest.java b/test/unit/org/apache/cassandra/index/sasi/SASICQLTest.java index c786184..e746fab 100644 --- a/test/unit/org/apache/cassandra/index/sasi/SASICQLTest.java +++ b/test/unit/org/apache/cassandra/index/sasi/SASICQLTest.java @@ -112,10 +112,10 @@ public class SASICQLTest extends CQLTester { createTable("CREATE TABLE %s (k int PRIMARY KEY, v int)"); - boolean enableSASIIndexes = DatabaseDescriptor.getEnableSASIIndexes(); + boolean enableSASIIndexes = DatabaseDescriptor.getSASIIndexesEnabled(); try { - DatabaseDescriptor.setEnableSASIIndexes(false); + DatabaseDescriptor.setSASIIndexesEnabled(false); createIndex("CREATE CUSTOM INDEX ON %s (v) USING 'org.apache.cassandra.index.sasi.SASIIndex'"); Assert.fail("Should not be able to create a SASI index if they are disabled"); } @@ -128,7 +128,7 @@ public class SASICQLTest extends CQLTester } finally { - DatabaseDescriptor.setEnableSASIIndexes(enableSASIIndexes); + DatabaseDescriptor.setSASIIndexesEnabled(enableSASIIndexes); } } diff --git a/test/unit/org/apache/cassandra/net/MessagingServiceTest.java b/test/unit/org/apache/cassandra/net/MessagingServiceTest.java index 871f592..3b5959b 100644 --- a/test/unit/org/apache/cassandra/net/MessagingServiceTest.java +++ b/test/unit/org/apache/cassandra/net/MessagingServiceTest.java @@ -347,12 +347,12 @@ public class MessagingServiceTest Set<InetAddressAndPort> expect = new HashSet<>(); expect.add(InetAddressAndPort.getByAddressOverrideDefaults(listenAddress, DatabaseDescriptor.getStoragePort())); - if (settings.encryption.enable_legacy_ssl_storage_port) + if (settings.encryption.legacy_ssl_storage_port_enabled) expect.add(InetAddressAndPort.getByAddressOverrideDefaults(listenAddress, DatabaseDescriptor.getSSLStoragePort())); if (listenOnBroadcastAddr) { expect.add(InetAddressAndPort.getByAddressOverrideDefaults(FBUtilities.getBroadcastAddressAndPort().getAddress(), DatabaseDescriptor.getStoragePort())); - if (settings.encryption.enable_legacy_ssl_storage_port) + if (settings.encryption.legacy_ssl_storage_port_enabled) expect.add(InetAddressAndPort.getByAddressOverrideDefaults(FBUtilities.getBroadcastAddressAndPort().getAddress(), DatabaseDescriptor.getSSLStoragePort())); } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org