Skip to content
Permalink
Browse files
Transfer config parameters to the new types; Fix corner case for perm…
…issions_update_interval, roles_update_interval, credentials_update_interval;Fix typo in Config annotation; Made Converters type safe and fixed a few cases where converters used the wrong type; o should be provided with unit to DataStorageSpec and DurationStorageSpec; Fix null bug in DataStorageSpec and DurationSpec

patch by Ekaterina Dimitrova, David Capwell; reviewed by David Capwell and Caleb Rackliffe for CASSANDRA-17431

Co-authored-by: Ekaterina Dimitrova <ekaterina.dimitrova@datastax.com>
Co-authored-by: David Capwell <dcapwell@apache.org>
  • Loading branch information
ekaterinadimitrova2 and David Capwell committed Apr 20, 2022
1 parent 03ef67c commit dac738d2eba8629d4f482d7cbfd855d2c5b9df47
Show file tree
Hide file tree
Showing 22 changed files with 421 additions and 195 deletions.
@@ -1,4 +1,9 @@
4.1
* Migrate advanced config parameters to the new Config types (CASSANDRA-17431)
* Make null to be meaning disabled and leave 0 as a valid value for permissions_update_interval, roles_update_interval, credentials_update_interval (CASSANDRA-17431)
* Fix typo in Config annotation (CASSANDRA-17431)
* Made Converters type safe and fixed a few cases where converters used the wrong type (CASSANDRA-17431)
* Fix null bug in DataStorageSpec and DurationSpec and require units to be added when providing 0 value (CASSANDRA-17431)
* Shutdown ScheduledExecutors as part of node drainage (CASSANDRA-17493)
* Provide JMX endpoint to allow transient logging of blocking read repairs (CASSANDRA-17471)
* Add guardrail for GROUP BY queries (CASSANDRA-17509)
@@ -136,10 +136,15 @@ Upgrading
will be removed in a future major release.
- There is a new cassandra.yaml version 2. Units suffixes should be provided for all rates(B/s|MiB/s|KiB/s|MiB/s),
memory (KiB|MiB|GiB|B) and duration(d|h|s|ms|us|µs|ns|m)
parameters. (CASSANDRA-15234)
parameters. List of changed parameters and details to consider during configuration setup can be
found at https://cassandra.apache.org/doc/latest/cassandra/new/configuration.html. (CASSANDRA-15234)
Backward compatibility with the old cassandra.yaml file will be in place until at least the next major version.
- Many cassandra.yaml parameters' names have been changed. Full list can be found on ...... (ADD LINK LATER WHEN PAGE
IS CREATED) (CASSANDRA-15234)
- Many cassandra.yaml parameters' names have been changed. Full list and details to consider during configuration setup
when installing/upgrading Cassandra can be found at https://cassandra.apache.org/doc/latest/cassandra/new/configuration.html (CASSANDRA-15234)
- Negative values cannot be used for parameters of type data rate, duration and data storage with both old and new cassandra.yaml version.
Only exception is if you use old cassandra.yaml, pre-CASSANDRA-15234 - then -1 or other negative values which were advertised as an option
to disable config parameters in the old cassandra.yaml are still used. Those are probably converted to null value with the new cassandra.yaml,
as written in the new cassandra.yaml version and docs.
- Before you upgrade, if you are using `cassandra.auth_bcrypt_gensalt_log2_rounds` property,
confirm it is set to value lower than 31 otherwise Cassandra will fail to start. See CASSANDRA-9384
for further details. You also need to regenerate passwords for users for who the password
@@ -41,8 +41,8 @@ Accepted units: seconds, minutes, hours, days.

Why was this needed?
Because we can run into precision issues. The full solution to the problem is to convert internally all parameters’ values
to be manipulated with the smallest supported by Cassandra unit. A series of tickets to assess and migrate to the smallest unit
our parameters (incrementally, post https://issues.apache.org/jira/browse/CASSANDRA-15234[CASSANDRA-15234]) will be opened soon.
to be manipulated with the smallest supported by Cassandra unit. A series of tickets to assess and maybe migrate to the smallest unit
our parameters (incrementally, post https://issues.apache.org/jira/browse/CASSANDRA-15234[CASSANDRA-15234]) will be opened in the future.


[cols=",,",options="header",]
@@ -52,7 +52,6 @@ our parameters (incrementally, post https://issues.apache.org/jira/browse/CASSAN
|permissions_update_interval_in_ms |permissions_update_interval |ms
|roles_validity_in_ms |roles_validity |ms
|roles_update_interval_in_ms |roles_update_interval |ms
|roles_update_interval_in_ms |roles_update_interval |ms
|credentials_validity_in_ms |credentials_validity |ms
|credentials_update_interval_in_ms |credentials_update_interval |ms
|max_hint_window_in_ms |max_hint_window |ms
@@ -131,9 +130,12 @@ our parameters (incrementally, post https://issues.apache.org/jira/browse/CASSAN
|enable_drop_compact_storage |drop_compact_storage_enabled |-
|enable_user_defined_functions_threads |user_defined_functions_threads_enabled |-
|enable_legacy_ssl_storage_port |legacy_ssl_storage_port_enabled |-
|user_defined_function_fail_timeout |user_defined_functions_fail_timeout |ms
|user_defined_function_warn_timeout |user_defined_functions_warn_timeout |ms
|cache_load_timeout_seconds |cache_load_timeout |s
|===

Another TO DO is to add JMX methods supporting the new format. However, we may abandon this if virtual tables support for
Another TO DO is to add JMX methods supporting the new format. However, we may abandon this if virtual tables support
configuration changes in the near future.

*Notes for Cassandra Developers*:
@@ -155,7 +157,9 @@ If the parameter is of type duration, data rate or data storage, its value shoul
- If for some reason you consider the smallest unit shouldn’t be the one that is supported as such in Cassandra, please,
use the extended classes `SmallestDuration*`, `SmallestDataStorage*`.

- New parameters should be added as non-negative numbers.
- New parameters should be added as non-negative numbers. For parameters where you would have set -1 to disable in the past, you might
want to consider a separate flag parameter or null value. In case you use the null value, please, ensure that any default value
introduced in the DatabaDescriptor to handle it is also duplicated in any related setters.

- Any time you add @Replaces with a name change, we need to add an entry in this https://github.com/riptano/ccm/blob/808b6ca13526785b0fddfe1ead2383c060c4b8b6/ccmlib/common.py#L62[Python dictionary in CCM] to support the same backward compatibility as SnakeYAML.

@@ -56,7 +56,7 @@ public static void applyAuth()
// work with PasswordAuthenticator, so log a message if some other authenticator
// is in use and non-default values are detected
if (!(authenticator instanceof PasswordAuthenticator)
&& (conf.credentials_update_interval.toMillisecondsAsInt() != 0
&& (conf.credentials_update_interval != null
|| conf.credentials_validity.toMillisecondsAsInt() != 2000
|| conf.credentials_cache_max_entries != 1000))
{
@@ -77,19 +77,19 @@ public static Set<String> splitCommaDelimited(String src)
public volatile SmallestDurationMilliseconds permissions_validity = new SmallestDurationMilliseconds("2s");
public volatile int permissions_cache_max_entries = 1000;
@Replaces(oldName = "permissions_update_interval_in_ms", converter = Converters.MILLIS_CUSTOM_DURATION, deprecated = true)
public volatile SmallestDurationMilliseconds permissions_update_interval = new SmallestDurationMilliseconds("0ms");
public volatile SmallestDurationMilliseconds permissions_update_interval = null;
public volatile boolean permissions_cache_active_update = false;
@Replaces(oldName = "roles_validity_in_ms", converter = Converters.MILLIS_DURATION, deprecated = true)
public volatile SmallestDurationMilliseconds roles_validity = new SmallestDurationMilliseconds("2s");
public volatile int roles_cache_max_entries = 1000;
@Replaces(oldName = "roles_update_interval_in_ms", converter = Converters.MILLIS_CUSTOM_DURATION, deprecated = true)
public volatile SmallestDurationMilliseconds roles_update_interval= new SmallestDurationMilliseconds("0ms");
public volatile SmallestDurationMilliseconds roles_update_interval = null;
public volatile boolean roles_cache_active_update = false;
@Replaces(oldName = "credentials_validity_in_ms", converter = Converters.MILLIS_DURATION, deprecated = true)
public volatile SmallestDurationMilliseconds credentials_validity = new SmallestDurationMilliseconds("2s");
public volatile int credentials_cache_max_entries = 1000;
@Replaces(oldName = "credentials_update_interval_in_ms", converter = Converters.MILLIS_CUSTOM_DURATION, deprecated = true)
public volatile SmallestDurationMilliseconds credentials_update_interval= new SmallestDurationMilliseconds("0ms");
public volatile SmallestDurationMilliseconds credentials_update_interval = null;
public volatile boolean credentials_cache_active_update = false;

/* Hashing strategy Random or OPHF */
@@ -257,12 +257,16 @@ public static Set<String> splitCommaDelimited(String src)
public volatile long native_transport_max_concurrent_connections_per_ip = -1L;
public boolean native_transport_flush_in_batches_legacy = false;
public volatile boolean native_transport_allow_older_protocols = true;
public volatile long native_transport_max_concurrent_requests_in_bytes_per_ip = -1L;
public volatile long native_transport_max_concurrent_requests_in_bytes = -1L;
// Below 2 parameters were fixed in 4.0 + to get default value when ==-1 (old name and value format) or ==null(new name and value format),
// not <=0 as it is in previous versions. Throwing config exceptions on < -1
@Replaces(oldName = "native_transport_max_concurrent_requests_in_bytes_per_ip", converter = Converters.BYTES_CUSTOM_DATASTORAGE, deprecated = true)
public volatile DataStorageSpec native_transport_max_request_data_in_flight_per_ip = null;
@Replaces(oldName = "native_transport_max_concurrent_requests_in_bytes", converter = Converters.BYTES_CUSTOM_DATASTORAGE, deprecated = true)
public volatile DataStorageSpec native_transport_max_request_data_in_flight = null;
public volatile boolean native_transport_rate_limiting_enabled = false;
public volatile int native_transport_max_requests_per_second = 1000000;
// not exposed in the yaml
public int native_transport_receive_queue_capacity_in_bytes = 1 << 20; // 1MiB
@Replaces(oldName = "native_transport_receive_queue_capacity_in_bytes", converter = Converters.BYTES_DATASTORAGE, deprecated = true)
public DataStorageSpec native_transport_receive_queue_capacity = new DataStorageSpec("1MiB");

@Deprecated
public Integer native_transport_max_negotiable_protocol_version = null;
@@ -425,7 +429,7 @@ public static Set<String> splitCommaDelimited(String src)

public SmallestDataStorageMebibytes paxos_cache_size = null;

@Replaces(oldName = "cache_load_timeout_seconds ", converter = Converters.SECONDS_DURATION, deprecated = true)
@Replaces(oldName = "cache_load_timeout_seconds", converter = Converters.SECONDS_DURATION, deprecated = true)
public SmallestDurationSeconds cache_load_timeout = new SmallestDurationSeconds("30s");

private static boolean isClientMode = false;
@@ -565,19 +569,17 @@ public static Set<String> splitCommaDelimited(String src)
* 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 user_defined_functions_threads_enabled==true)
*/
//TO DO: transfer below parameter to the new config framework (DurationSpec)
//Below parameter is in ms
public long user_defined_function_warn_timeout = 500;
@Replaces(oldName = "user_defined_function_warn_timeout", converter = Converters.MILLIS_DURATION, deprecated = true)
public SmallestDurationMilliseconds user_defined_functions_warn_timeout = new SmallestDurationMilliseconds("500ms");
/**
* 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 user_defined_functions_threads_enabled==true)
*/
//TO DO: transfer below parameter to the new config framework (DurationSpec)
//Below parameter is in ms
public long user_defined_function_fail_timeout = 1500;
@Replaces(oldName = "user_defined_function_fail_timeout", converter = Converters.MILLIS_DURATION, deprecated = true)
public SmallestDurationMilliseconds user_defined_functions_fail_timeout = new SmallestDurationMilliseconds("1500ms");
/**
* Defines what to do when a UDF ran longer than user_defined_function_fail_timeout.
* Defines what to do when a UDF ran longer than user_defined_functions_fail_timeout.
* Possible options are:
* - '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).
@@ -660,11 +662,13 @@ public static Set<String> splitCommaDelimited(String src)
public volatile boolean snapshot_on_repaired_data_mismatch = false;

/**
* number of seconds to set nowInSec into the future when performing validation previews against repaired data
* Number of seconds to set nowInSec into the future when performing validation previews against repaired data
* this (attempts) to prevent a race where validations on different machines are started on different sides of
* a tombstone being compacted away
*/
public volatile int validation_preview_purge_head_start_in_sec = 60 * 60;

@Replaces(oldName = "validation_preview_purge_head_start_in_sec", converter = Converters.NEGATIVE_SECONDS_DURATION, deprecated = true)
public volatile SmallestDurationSeconds validation_preview_purge_head_start = new SmallestDurationSeconds("3600s");

public boolean auth_cache_warming_enabled = false;

0 comments on commit dac738d

Please sign in to comment.