This is an automated email from the ASF dual-hosted git repository. maedhroz pushed a commit to branch cassandra-4.1 in repository https://gitbox.apache.org/repos/asf/cassandra.git
commit e5fc9b3e14d34e694f603ef80906b2c13eb70a3d Merge: 790de10798 93415c91af Author: Caleb Rackliffe <[email protected]> AuthorDate: Thu Aug 15 10:15:33 2024 -0500 Merge branch 'cassandra-4.0' into cassandra-4.1 * cassandra-4.0: Use default commitlog settings in test YAMLs CHANGES.txt | 1 + test/conf/cassandra-murmur.yaml | 4 +-- test/conf/cassandra-old.yaml | 4 +-- test/conf/cassandra-pem-jks-sslcontextfactory.yaml | 3 +- ...pem-sslcontextfactory-invalidconfiguration.yaml | 3 +- ...em-sslcontextfactory-mismatching-passwords.yaml | 3 +- ...ndra-pem-sslcontextfactory-unencryptedkeys.yaml | 3 +- test/conf/cassandra-pem-sslcontextfactory.yaml | 3 +- test/conf/cassandra-seeds.yaml | 4 +-- ...dra-sslcontextfactory-invalidconfiguration.yaml | 4 +-- test/conf/cassandra-sslcontextfactory.yaml | 4 +-- test/conf/cassandra.yaml | 4 +-- test/conf/unit-test-conf/test-native-port.yaml | 4 +-- .../cassandra/distributed/impl/InstanceConfig.java | 7 ++-- .../distributed/test/RepairBoundaryTest.java | 1 - .../cassandra/distributed/test/RepairTest.java | 1 - .../test/ReplicaFilteringProtectionTest.java | 3 +- .../cassandra/simulator/ClusterSimulation.java | 40 ++++++++++++++-------- .../config/FailStartupDuplicateParamsTest.java | 3 +- .../LoadOldYAMLBackwardCompatibilityTest.java | 2 +- .../cassandra/config/ParseAndConvertUnitsTest.java | 2 +- test/unit/org/apache/cassandra/cql3/CQLTester.java | 11 ++++-- .../db/commitlog/CommitLogReaderTest.java | 9 ++++- 23 files changed, 75 insertions(+), 48 deletions(-) diff --cc CHANGES.txt index 4bec8fe7bc,b2424f106f..0f8d48e83b --- a/CHANGES.txt +++ b/CHANGES.txt @@@ -1,11 -1,5 +1,12 @@@ -4.0.14 +4.1.6 + * Add native transport deadline, an ultimate deadline for all tasks related to a specific request (CASSANDRA-19534) + * Do not create a role if ALTER ROLE IF EXISTS operates on non-existing role (CASSANDRA-19749) + * Use OpOrder in repairIterator to ensure we don't lose memtables mid-paxos repair (Cassandra-19668) + * Refresh stale paxos commit (CASSANDRA-19617) + * Reduce info logging from automatic paxos repair (CASSANDRA-19445) + * Support legacy plain_text_auth section in credentials file removed unintentionally (CASSANDRA-19498) +Merged from 4.0: + * Use default commitlog settings in test YAMLs (CASSANDRA-19830) * Do not spam log with SSLExceptions (CASSANDRA-18839) * Fix schema.cql created by a snapshot after dropping more than one column (CASSANDRA-19747) * UnsupportedOperationException when reducing scope for LCS compactions (CASSANDRA-19704) diff --cc test/conf/cassandra-murmur.yaml index c0c2ae71f6,b64f6683c8..93043b0749 --- a/test/conf/cassandra-murmur.yaml +++ b/test/conf/cassandra-murmur.yaml @@@ -4,9 -4,9 +4,9 @@@ # cluster_name: Test Cluster memtable_allocation_type: heap_buffers - commitlog_sync: batch - commitlog_sync_batch_window_in_ms: 1.0 + commitlog_sync: periodic -commitlog_sync_period_in_ms: 10000 -commitlog_segment_size_in_mb: 5 ++commitlog_sync_period: 10s +commitlog_segment_size: 5MiB commitlog_directory: build/test/cassandra/commitlog cdc_raw_directory: build/test/cassandra/cdc_raw cdc_enabled: false diff --cc test/conf/cassandra-old.yaml index 86983acc9e,0000000000..e63a11c49a mode 100644,000000..100644 --- a/test/conf/cassandra-old.yaml +++ b/test/conf/cassandra-old.yaml @@@ -1,58 -1,0 +1,58 @@@ +# +# Warning! +# Consider the effects on 'o.a.c.i.s.LegacySSTableTest' before changing schemas in this file. +# +cluster_name: Test Cluster +# memtable_allocation_type: heap_buffers +memtable_allocation_type: offheap_objects - commitlog_sync: batch - commitlog_sync_batch_window_in_ms: 1.0 ++commitlog_sync: periodic ++commitlog_sync_period: 10s +commitlog_segment_size_in_mb: 5 +commitlog_directory: build/test/cassandra/commitlog +# commitlog_compression: +# - class_name: LZ4Compressor +cdc_raw_directory: build/test/cassandra/cdc_raw +cdc_enabled: false +hints_directory: build/test/cassandra/hints +partitioner: org.apache.cassandra.dht.ByteOrderedPartitioner +listen_address: 127.0.0.1 +storage_port: 7012 +ssl_storage_port: 17012 +start_native_transport: true +native_transport_port: 9042 +column_index_size: 4KiB +saved_caches_directory: build/test/cassandra/saved_caches +data_file_directories: + - build/test/cassandra/data +disk_access_mode: mmap +seed_provider: + - class_name: org.apache.cassandra.locator.SimpleSeedProvider + parameters: + - seeds: "127.0.0.1:7012" +endpoint_snitch: org.apache.cassandra.locator.SimpleSnitch +dynamic_snitch: true +server_encryption_options: + internode_encryption: none + keystore: conf/.keystore + keystore_password: cassandra + truststore: conf/.truststore + truststore_password: cassandra +incremental_backups: true +concurrent_compactors: 4 +compaction_throughput_mb_per_sec: 64 +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 +prepared_statements_cache_size_mb: +corrupted_tombstone_strategy: exception +stream_entire_sstables: true +stream_throughput_outbound_megabits_per_sec: 200000000 +enable_sasi_indexes: true +enable_materialized_views: true +enable_drop_compact_storage: true +file_cache_enabled: true +internode_send_buff_size_in_bytes: 5 +internode_recv_buff_size_in_bytes: 5 +max_hint_window_in_ms: 10800000 +cache_load_timeout_seconds: 35 diff --cc test/conf/cassandra-pem-jks-sslcontextfactory.yaml index 1f10e6c203,0000000000..1fbc1b2e79 mode 100644,000000..100644 --- a/test/conf/cassandra-pem-jks-sslcontextfactory.yaml +++ b/test/conf/cassandra-pem-jks-sslcontextfactory.yaml @@@ -1,150 -1,0 +1,151 @@@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# +# Testing for pluggable ssl_context_factory option for client and server encryption options with a valid and a missing +# implementation classes. +# +cluster_name: Test Cluster +# memtable_allocation_type: heap_buffers +memtable_allocation_type: offheap_objects - commitlog_sync: batch ++commitlog_sync: periodic ++commitlog_sync_period: 10s +commitlog_segment_size: 5MiB +commitlog_directory: build/test/cassandra/commitlog +# commitlog_compression: +# - class_name: LZ4Compressor +cdc_raw_directory: build/test/cassandra/cdc_raw +cdc_enabled: false +hints_directory: build/test/cassandra/hints +partitioner: org.apache.cassandra.dht.ByteOrderedPartitioner +listen_address: 127.0.0.1 +storage_port: 7012 +ssl_storage_port: 17012 +start_native_transport: true +native_transport_port: 9042 +column_index_size: 4KiB +saved_caches_directory: build/test/cassandra/saved_caches +data_file_directories: + - build/test/cassandra/data +disk_access_mode: mmap +seed_provider: + - class_name: org.apache.cassandra.locator.SimpleSeedProvider + parameters: + - seeds: "127.0.0.1:7012" +endpoint_snitch: org.apache.cassandra.locator.SimpleSnitch +dynamic_snitch: true +client_encryption_options: + ssl_context_factory: + class_name: org.apache.cassandra.security.PEMBasedSslContextFactory + parameters: + private_key: | + -----BEGIN ENCRYPTED PRIVATE KEY----- + MIIE6jAcBgoqhkiG9w0BDAEDMA4ECOWqSzq5PBIdAgIFxQSCBMjXsCK30J0aT3J/ + g5kcbmevTOY1pIhJGbf5QYYrMUPiuDK2ydxIbiPzoTE4/S+OkCeHhlqwn/YydpBl + xgjZZ1Z5rLJHO27d2biuESqanDiBVXYuVmHmaifRnFy0uUTFkStB5mjVZEiJgO29 + L83hL60uWru71EVuVriC2WCfmZ/EXp6wyYszOqCFQ8Quk/rDO6XuaBl467MJbx5V + sucGT6E9XKNd9hB14/Izb2jtVM5kqKxoiHpz1na6yhEYJiE5D1uOonznWjBnjwB/ + f0x+acpDfVDoJKTlRdz+DEcbOF7mb9lBVVjP6P/AAs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xRWNUn4hu6mG6mayk4XliGRqI1VZupqh+MgNqHznuTd0bA + YrQsFPw9HaZ2hvVnJffJ5l7njAekZNOL+wIDAQABoyEwHzAdBgNVHQ4EFgQUcdiD + N6aylI91kAd34Hl2AzWY51QwDQYJKoZIhvcNAQELBQADggEBAG9q29ilUgCWQP5v + iHkZHj10gXGEoMkdfrPBf8grC7dpUcaw1Qfku/DJ7kPvMALeEsmFDk/t78roeNbh + IYBLJlzI1HZN6VPtpWQGsqxltAy5XN9Xw9mQM/tu70ShgsodGmE1UoW6eE5+/GMv + 6Fg+zLuICPvs2cFNmWUvukN5LW146tJSYCv0Q/rCPB3m9dNQ9pBxrzPUHXw4glwG + qGnGddXmOC+tSW5lDLLG1BRbKv4zxv3UlrtIjqlJtZb/sQMT6WtG2ihAz7SKOBHa + HOWUwuPTetWIuJCKP7P4mWWtmSmjLy+BFX5seNEngn3RzJ2L8uuTJQ/88OsqgGru + n3MVF9w= + -----END CERTIFICATE----- + private_key_password: "cassandra" + trusted_certificates: | + -----BEGIN CERTIFICATE----- + MIIDkTCCAnmgAwIBAgIETxH5JDANBgkqhkiG9w0BAQsFADB5MRAwDgYDVQQGEwdV + bmtub3duMRAwDgYDVQQIEwdVbmtub3duMRAwDgYDVQQHEwdVbmtub3duMRAwDgYD + VQQKEwdVbmtub3duMRQwEgYDVQQLDAtzc2xfdGVzdGluZzEZMBcGA1UEAxMQQXBh + Y2hlIENhc3NhbmRyYTAeFw0xNjAzMTgyMTI4MDJaFw0xNjA2MTYyMTI4MDJaMHkx + EDAOBgNVBAYTB1Vua25vd24xEDAOBgNVBAgTB1Vua25vd24xEDAOBgNVBAcTB1Vu + a25vd24xEDAOBgNVBAoTB1Vua25vd24xFDASBgNVBAsMC3NzbF90ZXN0aW5nMRkw + FwYDVQQDExBBcGFjaGUgQ2Fzc2FuZHJhMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A + MIIBCgKCAQEAjkmVX/HS49cS8Hn6o26IGwMIcEV3d7ZhH0GNcx8rnSRd10dU9F6d + ugSjbwGFMcWUQzYNejN6az0Wb8JIQyXRPTWjfgaWTyVGr0bGTnxg6vwhzfI/9jzy + q59xv29OuSY1dxmY31f0pZ9OOw3mabWksjoO2TexfKoxqsRHJ8PrM1f8E84Z4xo2 + TJXGzpuIxRkAJ+sVDqKEAhrKAfRYMSgdJ7zRt8VXv9ngjX20uA2m092NcH0Kmeto + TmuWUtK8E/qcN7ULN8xRWNUn4hu6mG6mayk4XliGRqI1VZupqh+MgNqHznuTd0bA + YrQsFPw9HaZ2hvVnJffJ5l7njAekZNOL+wIDAQABoyEwHzAdBgNVHQ4EFgQUcdiD + N6aylI91kAd34Hl2AzWY51QwDQYJKoZIhvcNAQELBQADggEBAG9q29ilUgCWQP5v + iHkZHj10gXGEoMkdfrPBf8grC7dpUcaw1Qfku/DJ7kPvMALeEsmFDk/t78roeNbh + IYBLJlzI1HZN6VPtpWQGsqxltAy5XN9Xw9mQM/tu70ShgsodGmE1UoW6eE5+/GMv + 6Fg+zLuICPvs2cFNmWUvukN5LW146tJSYCv0Q/rCPB3m9dNQ9pBxrzPUHXw4glwG + qGnGddXmOC+tSW5lDLLG1BRbKv4zxv3UlrtIjqlJtZb/sQMT6WtG2ihAz7SKOBHa + HOWUwuPTetWIuJCKP7P4mWWtmSmjLy+BFX5seNEngn3RzJ2L8uuTJQ/88OsqgGru + n3MVF9w= + -----END CERTIFICATE----- +server_encryption_options: + internode_encryption: none + keystore: test/conf/cassandra_ssl_test.keystore + keystore_password: cassandra + truststore: test/conf/cassandra_ssl_test.truststore + truststore_password: cassandra +incremental_backups: true +concurrent_compactors: 4 +compaction_throughput: 0MiB/s +row_cache_class_name: org.apache.cassandra.cache.OHCProvider +row_cache_size: 16MiB +user_defined_functions_enabled: true +scripted_user_defined_functions_enabled: true +prepared_statements_cache_size: 1MiB +corrupted_tombstone_strategy: exception +stream_entire_sstables: true +stream_throughput_outbound: 24MiB/s +sasi_indexes_enabled: true +materialized_views_enabled: true +file_cache_enabled: true diff --cc test/conf/cassandra-pem-sslcontextfactory-invalidconfiguration.yaml index 8c7d910f49,0000000000..b833d1c949 mode 100644,000000..100644 --- a/test/conf/cassandra-pem-sslcontextfactory-invalidconfiguration.yaml +++ b/test/conf/cassandra-pem-sslcontextfactory-invalidconfiguration.yaml @@@ -1,147 -1,0 +1,148 @@@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# +# Testing for pluggable ssl_context_factory option for client and server encryption options with a valid and a missing +# implementation classes. +# +cluster_name: Test Cluster +# memtable_allocation_type: heap_buffers +memtable_allocation_type: offheap_objects - commitlog_sync: batch ++commitlog_sync: periodic ++commitlog_sync_period: 10s +commitlog_segment_size: 5MiB +commitlog_directory: build/test/cassandra/commitlog +# commitlog_compression: +# - class_name: LZ4Compressor +cdc_raw_directory: build/test/cassandra/cdc_raw +cdc_enabled: false +hints_directory: build/test/cassandra/hints +partitioner: org.apache.cassandra.dht.ByteOrderedPartitioner +listen_address: 127.0.0.1 +storage_port: 7012 +ssl_storage_port: 17012 +start_native_transport: true +native_transport_port: 9042 +column_index_size: 4KiB +saved_caches_directory: build/test/cassandra/saved_caches +data_file_directories: + - build/test/cassandra/data +disk_access_mode: mmap +seed_provider: + - class_name: org.apache.cassandra.locator.SimpleSeedProvider + parameters: + - seeds: "127.0.0.1:7012" +endpoint_snitch: org.apache.cassandra.locator.SimpleSnitch +dynamic_snitch: true +client_encryption_options: + ssl_context_factory: + class_name: org.apache.cassandra.security.PEMBasedSslContextFactory + parameters: + private_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TB1Vua25vd24xFDASBgNVBAsMC3NzbF90ZXN0aW5nMRkw + FwYDVQQDExBBcGFjaGUgQ2Fzc2FuZHJhMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A + MIIBCgKCAQEAjkmVX/HS49cS8Hn6o26IGwMIcEV3d7ZhH0GNcx8rnSRd10dU9F6d + ugSjbwGFMcWUQzYNejN6az0Wb8JIQyXRPTWjfgaWTyVGr0bGTnxg6vwhzfI/9jzy + q59xv29OuSY1dxmY31f0pZ9OOw3mabWksjoO2TexfKoxqsRHJ8PrM1f8E84Z4xo2 + TJXGzpuIxRkAJ+sVDqKEAhrKAfRYMSgdJ7zRt8VXv9ngjX20uA2m092NcH0Kmeto + TmuWUtK8E/qcN7ULN8xRWNUn4hu6mG6mayk4XliGRqI1VZupqh+MgNqHznuTd0bA + YrQsFPw9HaZ2hvVnJffJ5l7njAekZNOL+wIDAQABoyEwHzAdBgNVHQ4EFgQUcdiD + N6aylI91kAd34Hl2AzWY51QwDQYJKoZIhvcNAQELBQADggEBAG9q29ilUgCWQP5v + iHkZHj10gXGEoMkdfrPBf8grC7dpUcaw1Qfku/DJ7kPvMALeEsmFDk/t78roeNbh + IYBLJlzI1HZN6VPtpWQGsqxltAy5XN9Xw9mQM/tu70ShgsodGmE1UoW6eE5+/GMv + 6Fg+zLuICPvs2cFNmWUvukN5LW146tJSYCv0Q/rCPB3m9dNQ9pBxrzPUHXw4glwG + qGnGddXmOC+tSW5lDLLG1BRbKv4zxv3UlrtIjqlJtZb/sQMT6WtG2ihAz7SKOBHa + HOWUwuPTetWIuJCKP7P4mWWtmSmjLy+BFX5seNEngn3RzJ2L8uuTJQ/88OsqgGru + n3MVF9w= + -----END CERTIFICATE----- + private_key_password: "cassandra" + trusted_certificates: | + -----BEGIN CERTIFICATE----- + MIIDkTCCAnmgAwIBAgIETxH5JDANBgkqhkiG9w0BAQsFADB5MRAwDgYDVQQGEwdV + bmtub3duMRAwDgYDVQQIEwdVbmtub3duMRAwDgYDVQ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+ HOWUwuPTetWIuJCKP7P4mWWtmSmjLy+BFX5seNEngn3RzJ2L8uuTJQ/88OsqgGru + n3MVF9w= + -----END CERTIFICATE----- + keystore: test/conf/cassandra_ssl_test.keystore.pem + keystore_password: cassandra + truststore: test/conf/cassandra_ssl_test.truststore.pem +incremental_backups: true +concurrent_compactors: 4 +compaction_throughput: 0MiB/s +row_cache_class_name: org.apache.cassandra.cache.OHCProvider +row_cache_size: 16MiB +user_defined_functions_enabled: true +scripted_user_defined_functions_enabled: true +prepared_statements_cache_size: 1MiB +corrupted_tombstone_strategy: exception +stream_entire_sstables: true +stream_throughput_outbound: 24MiB/s +sasi_indexes_enabled: true +materialized_views_enabled: true +file_cache_enabled: true diff --cc test/conf/cassandra-pem-sslcontextfactory-mismatching-passwords.yaml index 5d64354208,0000000000..e4ecef5568 mode 100644,000000..100644 --- a/test/conf/cassandra-pem-sslcontextfactory-mismatching-passwords.yaml +++ b/test/conf/cassandra-pem-sslcontextfactory-mismatching-passwords.yaml @@@ -1,154 -1,0 +1,155 @@@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# +# Testing for pluggable ssl_context_factory option for client and server encryption options with a valid and a missing +# implementation classes. +# +cluster_name: Test Cluster +# memtable_allocation_type: heap_buffers +memtable_allocation_type: offheap_objects - commitlog_sync: batch ++commitlog_sync: periodic ++commitlog_sync_period: 10s +commitlog_segment_size: 5MiB +commitlog_directory: build/test/cassandra/commitlog +# commitlog_compression: +# - class_name: LZ4Compressor +cdc_raw_directory: build/test/cassandra/cdc_raw +cdc_enabled: false +hints_directory: build/test/cassandra/hints +partitioner: org.apache.cassandra.dht.ByteOrderedPartitioner +listen_address: 127.0.0.1 +storage_port: 7012 +ssl_storage_port: 17012 +start_native_transport: true +native_transport_port: 9042 +column_index_size: 4KiB +saved_caches_directory: build/test/cassandra/saved_caches +data_file_directories: + - build/test/cassandra/data +disk_access_mode: mmap +seed_provider: + - class_name: org.apache.cassandra.locator.SimpleSeedProvider + parameters: + - seeds: "127.0.0.1:7012" +endpoint_snitch: org.apache.cassandra.locator.SimpleSnitch +dynamic_snitch: true +client_encryption_options: + ssl_context_factory: + class_name: org.apache.cassandra.security.PEMBasedSslContextFactory + parameters: + private_key: | + -----BEGIN ENCRYPTED PRIVATE KEY----- + MIIE6jAcBgoqhkiG9w0BDAEDMA4ECOWqSzq5PBIdAgIFxQSCBMjXsCK30J0aT3J/ + g5kcbmevTOY1pIhJGbf5QYYrMUPiuDK2ydxIbiPzoTE4/S+OkCeHhlqwn/YydpBl + xgjZZ1Z5rLJHO27d2biuESqanDiBVXYuVmHmaifRnFy0uUTFkStB5mjVZEiJgO29 + L83hL60uWru71EVuVriC2WCfmZ/EXp6wyYszOqCFQ8Quk/rDO6XuaBl467MJbx5V + sucGT6E9XKNd9hB14/Izb2jtVM5kqKxoiHpz1na6yhEYJiE5D1uOonznWjBnjwB/ + f0x+acpDfVDoJKTlRdz+DEcbOF7mb9lBVVjP6P/AAsmQzz6JKwHjvCrjYfQmyyN8 + RI4KRQnWgm4L3dtByLqY8HFU4ogisCMCgI+hZQ+OKMz/hoRO540YGiPcTRY3EOUR + 0bd5JxU6tCJDMTqKP9aSL2KmLoiLowdMkSPz7TCzLsZ2bGJemuCfpAs4XT1vXCHs + evrUbOnh8et1IA8mZ9auThfqsZtNagJLEXA6hWIKp1FfVL3Q49wvMKZt4eTn/zwU + tLL0m5yPo6/HAaOA3hbm/oghZS0dseshXl7PZrmZQtvYnIvjyoxEL7ducYDQCDP6 + wZ7Nzyh1QZ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Mv + 6Fg+zLuICPvs2cFNmWUvukN5LW146tJSYCv0Q/rCPB3m9dNQ9pBxrzPUHXw4glwG + qGnGddXmOC+tSW5lDLLG1BRbKv4zxv3UlrtIjqlJtZb/sQMT6WtG2ihAz7SKOBHa + HOWUwuPTetWIuJCKP7P4mWWtmSmjLy+BFX5seNEngn3RzJ2L8uuTJQ/88OsqgGru + n3MVF9w= + -----END CERTIFICATE----- + private_key_password: "cassandra" + trusted_certificates: | + -----BEGIN CERTIFICATE----- + MIIDkTCCAnmgAwIBAgIETxH5JDANBgkqhkiG9w0BAQsFADB5MRAwDgYDVQQGEwdV + bmtub3duMRAwDgYDVQQIEwdVbmtub3duMRAwDgYDVQQHEwdVbmtub3duMRAwDgYD + VQQKEwdVbmtub3duMRQwEgYDVQQLDAtzc2xfdGVzdGluZzEZMBcGA1UEAxMQQXBh + Y2hlIENhc3NhbmRyYTAeFw0xNjAzMTgyMTI4MDJaFw0xNjA2MTYyMTI4MDJaMHkx + EDAOBgNVBAYTB1Vua25vd24xEDAOBgNVBAgTB1Vua25vd24xEDAOBgNVBAcTB1Vu + a25vd24xEDAOBgNVBAoTB1Vua25vd24xFDASBgNVBAsMC3NzbF90ZXN0aW5nMRkw + FwYDVQQDExBBcGFjaGUgQ2Fzc2FuZHJhMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A + MIIBCgKCAQEAjkmVX/HS49cS8Hn6o26IGwMIcEV3d7ZhH0GNcx8rnSRd10dU9F6d + ugSjbwGFMcWUQzYNejN6az0Wb8JIQyXRPTWjfgaWTyVGr0bGTnxg6vwhzfI/9jzy + q59xv29OuSY1dxmY31f0pZ9OOw3mabWksjoO2TexfKoxqsRHJ8PrM1f8E84Z4xo2 + TJXGzpuIxRkAJ+sVDqKEAhrKAfRYMSgdJ7zRt8VXv9ngjX20uA2m092NcH0Kmeto + TmuWUtK8E/qcN7ULN8xRWNUn4hu6mG6mayk4XliGRqI1VZupqh+MgNqHznuTd0bA + YrQsFPw9HaZ2hvVnJffJ5l7njAekZNOL+wIDAQABoyEwHzAdBgNVHQ4EFgQUcdiD + N6aylI91kAd34Hl2AzWY51QwDQYJKoZIhvcNAQELBQADggEBAG9q29ilUgCWQP5v + iHkZHj10gXGEoMkdfrPBf8grC7dpUcaw1Qfku/DJ7kPvMALeEsmFDk/t78roeNbh + IYBLJlzI1HZN6VPtpWQGsqxltAy5XN9Xw9mQM/tu70ShgsodGmE1UoW6eE5+/GMv + 6Fg+zLuICPvs2cFNmWUvukN5LW146tJSYCv0Q/rCPB3m9dNQ9pBxrzPUHXw4glwG + qGnGddXmOC+tSW5lDLLG1BRbKv4zxv3UlrtIjqlJtZb/sQMT6WtG2ihAz7SKOBHa + HOWUwuPTetWIuJCKP7P4mWWtmSmjLy+BFX5seNEngn3RzJ2L8uuTJQ/88OsqgGru + n3MVF9w= + -----END CERTIFICATE----- + keystore_password: cassandra-abracadbra +server_encryption_options: + ssl_context_factory: + class_name: org.apache.cassandra.security.PEMBasedSslContextFactory + parameters: + private_key_password: "cassandra-abracadbra" + internode_encryption: none + keystore: test/conf/cassandra_ssl_test.keystore.pem + keystore_password: cassandra + truststore: test/conf/cassandra_ssl_test.truststore.pem +incremental_backups: true +concurrent_compactors: 4 +compaction_throughput: 0MiB/s +row_cache_class_name: org.apache.cassandra.cache.OHCProvider +row_cache_size: 16MiB +user_defined_functions_enabled: true +scripted_user_defined_functions_enabled: false +prepared_statements_cache_size: 1MiB +corrupted_tombstone_strategy: exception +stream_entire_sstables: true +stream_throughput_outbound: 24MiB/s +sasi_indexes_enabled: true +materialized_views_enabled: true +file_cache_enabled: true diff --cc test/conf/cassandra-pem-sslcontextfactory-unencryptedkeys.yaml index 7b08bcce03,0000000000..3228ed0163 mode 100644,000000..100644 --- a/test/conf/cassandra-pem-sslcontextfactory-unencryptedkeys.yaml +++ b/test/conf/cassandra-pem-sslcontextfactory-unencryptedkeys.yaml @@@ -1,148 -1,0 +1,149 @@@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# +# Testing for pluggable ssl_context_factory option for client and server encryption options with a valid and a missing +# implementation classes. +# +cluster_name: Test Cluster +# memtable_allocation_type: heap_buffers +memtable_allocation_type: offheap_objects - commitlog_sync: batch ++commitlog_sync: periodic ++commitlog_sync_period: 10s +commitlog_segment_size: 5MiB +commitlog_directory: build/test/cassandra/commitlog +# commitlog_compression: +# - class_name: LZ4Compressor +cdc_raw_directory: build/test/cassandra/cdc_raw +cdc_enabled: false +hints_directory: build/test/cassandra/hints +partitioner: org.apache.cassandra.dht.ByteOrderedPartitioner +listen_address: 127.0.0.1 +storage_port: 7012 +ssl_storage_port: 17012 +start_native_transport: true +native_transport_port: 9042 +column_index_size: 4KiB +saved_caches_directory: build/test/cassandra/saved_caches +data_file_directories: + - build/test/cassandra/data +disk_access_mode: mmap +seed_provider: + - class_name: org.apache.cassandra.locator.SimpleSeedProvider + parameters: + - seeds: "127.0.0.1:7012" +endpoint_snitch: org.apache.cassandra.locator.SimpleSnitch +dynamic_snitch: true +client_encryption_options: + ssl_context_factory: + class_name: org.apache.cassandra.security.PEMBasedSslContextFactory + parameters: + private_key: | + -----BEGIN PRIVATE KEY----- + MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCOSZVf8dLj1xLw + efqjbogbAwhwRXd3tmEfQY1zHyudJF3XR1T0Xp26BKNvAYUxxZRDNg16M3prPRZv + wkhDJdE9NaN+BpZPJUavRsZOfGDq/CHN8j/2PPKrn3G/b065JjV3GZjfV/Sln047 + DeZptaSyOg7ZN7F8qjGqxEcnw+szV/wTzhnjGjZMlcbOm4jFGQAn6xUOooQCGsoB + 9FgxKB0nvNG3xVe/2eCNfbS4DabT3Y1wfQqZ62hOa5ZS0rwT+pw3tQs3zFFY1Sfi + G7qYbqZrKTheWIZGojVVm6mqH4yA2ofOe5N3RsBitCwU/D0dpnaG9Wcl98nmXueM + B6Rk04v7AgMBAAECggEAYnxIKjrFz/JkJ5MmiszM5HV698r9YB0aqHnFIHPoykIL + uiCjiumantDrFsCkosixULwvI/BRwbxstTpyrheU9psT6P1CONICVPvV8ylgJAYU + l+ofn56cEXKxVuICSWFLDH7pM1479g+IJJQAchbKQpqxAGTuMu3SpvJolfuj5srt + bM7/RYhJFLwDuvHNA3ivlogMneItP03+C25aaxstM+lBuBf68+n78zMgSvt6J/6Y + G2TOMKnxveMlG2qu9l2lAw/2i8daG/qre08nTH7wpRx0gZLZqNpe45exkrzticzF + FgWYjG2K2brX21jqHroFgMhdXF7zhhRgLoIeC0BrIQKBgQDCfGfWrJESKBbVai5u + 7wqD9nlzjv6N6FXfTDOPXO1vz5frdvtLVWbs0SMPy+NglkaZK0iqHvb9mf2of8eC + 0D5cmewjn7WCDBQMypIMYgT912ak/BBVuGXcxb6UgD+xARfSARo2C8NG1hfprw1W + ad14CjS5xhFMs44HpVYhI7iPYwKBgQC7SqVG/b37vZ7CINemdvoMujLvvYXDJJM8 + N21LqNJfVXdukdH3T0xuLnh9Z/wPHjJDMF/9+1foxSEPHijtyz5P19EilNEC/3qw + fI19+VZoY0mdhPtXSGzy+rbTE2v71QgwFLizSos14Gr+eNiIjF7FYccK05++K/zk + cd8ZA3bwiQKBgQCl+HTFBs9mpz+VMOAfW2+l3hkXPNiPUc62mNkHZ05ZNNd44jjh + uSf0wSUiveR08MmevQlt5K7zDQ8jVKh2QjB15gVXAVxsdtJFeDnax2trFP9LnLBz + 9sE2/qn9INU5wK0LUlWD+dXUBbCyg+jl7cJKRqtoPldVFYYHkFlIPqup8QKBgHXv + h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dJ7zRt8VXv9ngjX20uA2m092NcH0Kmeto + TmuWUtK8E/qcN7ULN8xRWNUn4hu6mG6mayk4XliGRqI1VZupqh+MgNqHznuTd0bA + YrQsFPw9HaZ2hvVnJffJ5l7njAekZNOL+wIDAQABoyEwHzAdBgNVHQ4EFgQUcdiD + N6aylI91kAd34Hl2AzWY51QwDQYJKoZIhvcNAQELBQADggEBAG9q29ilUgCWQP5v + iHkZHj10gXGEoMkdfrPBf8grC7dpUcaw1Qfku/DJ7kPvMALeEsmFDk/t78roeNbh + IYBLJlzI1HZN6VPtpWQGsqxltAy5XN9Xw9mQM/tu70ShgsodGmE1UoW6eE5+/GMv + 6Fg+zLuICPvs2cFNmWUvukN5LW146tJSYCv0Q/rCPB3m9dNQ9pBxrzPUHXw4glwG + qGnGddXmOC+tSW5lDLLG1BRbKv4zxv3UlrtIjqlJtZb/sQMT6WtG2ihAz7SKOBHa + HOWUwuPTetWIuJCKP7P4mWWtmSmjLy+BFX5seNEngn3RzJ2L8uuTJQ/88OsqgGru + n3MVF9w= + -----END CERTIFICATE----- + trusted_certificates: | + -----BEGIN CERTIFICATE----- + MIIDkTCCAnmgAwIBAgIETxH5JDANBgkqhkiG9w0BAQsFADB5MRAwDgYDVQQGEwdV + bmtub3duMRAwDgYDVQQIEwdVbmtub3duMRAwDgYDVQQHEwdVbmtub3duMRAwDgYD + VQQKEwdVbmtub3duMRQwEgYDVQQLDAtzc2xfdGVzdGluZzEZMBcGA1UEAxMQQXBh + Y2hlIENhc3NhbmRyYTAeFw0xNjAzMTgyMTI4MDJaFw0xNjA2MTYyMTI4MDJaMHkx + EDAOBgNVBAYTB1Vua25vd24xEDAOBgNVBAgTB1Vua25vd24xEDAOBgNVBAcTB1Vu + a25vd24xEDAOBgNVBAoTB1Vua25vd24xFDASBgNVBAsMC3NzbF90ZXN0aW5nMRkw + FwYDVQQDExBBcGFjaGUgQ2Fzc2FuZHJhMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A + MIIBCgKCAQEAjkmVX/HS49cS8Hn6o26IGwMIcEV3d7ZhH0GNcx8rnSRd10dU9F6d + ugSjbwGFMcWUQzYNejN6az0Wb8JIQyXRPTWjfgaWTyVGr0bGTnxg6vwhzfI/9jzy + q59xv29OuSY1dxmY31f0pZ9OOw3mabWksjoO2TexfKoxqsRHJ8PrM1f8E84Z4xo2 + TJXGzpuIxRkAJ+sVDqKEAhrKAfRYMSgdJ7zRt8VXv9ngjX20uA2m092NcH0Kmeto + TmuWUtK8E/qcN7ULN8xRWNUn4hu6mG6mayk4XliGRqI1VZupqh+MgNqHznuTd0bA + YrQsFPw9HaZ2hvVnJffJ5l7njAekZNOL+wIDAQABoyEwHzAdBgNVHQ4EFgQUcdiD + N6aylI91kAd34Hl2AzWY51QwDQYJKoZIhvcNAQELBQADggEBAG9q29ilUgCWQP5v + iHkZHj10gXGEoMkdfrPBf8grC7dpUcaw1Qfku/DJ7kPvMALeEsmFDk/t78roeNbh + IYBLJlzI1HZN6VPtpWQGsqxltAy5XN9Xw9mQM/tu70ShgsodGmE1UoW6eE5+/GMv + 6Fg+zLuICPvs2cFNmWUvukN5LW146tJSYCv0Q/rCPB3m9dNQ9pBxrzPUHXw4glwG + qGnGddXmOC+tSW5lDLLG1BRbKv4zxv3UlrtIjqlJtZb/sQMT6WtG2ihAz7SKOBHa + HOWUwuPTetWIuJCKP7P4mWWtmSmjLy+BFX5seNEngn3RzJ2L8uuTJQ/88OsqgGru + n3MVF9w= + -----END CERTIFICATE----- +server_encryption_options: + ssl_context_factory: + class_name: org.apache.cassandra.security.PEMBasedSslContextFactory + internode_encryption: none + keystore: test/conf/cassandra_ssl_test.unencrypted_keystore.pem + truststore: test/conf/cassandra_ssl_test.truststore.pem +incremental_backups: true +concurrent_compactors: 4 +compaction_throughput: 0MiB/s +row_cache_class_name: org.apache.cassandra.cache.OHCProvider +row_cache_size: 16MiB +user_defined_functions_enabled: true +scripted_user_defined_functions_enabled: false +prepared_statements_cache_size: 1MiB +corrupted_tombstone_strategy: exception +stream_entire_sstables: true +stream_throughput_outbound: 24MiB/s +sasi_indexes_enabled: true +materialized_views_enabled: true +file_cache_enabled: true diff --cc test/conf/cassandra-pem-sslcontextfactory.yaml index 26d0f1f998,0000000000..f037125041 mode 100644,000000..100644 --- a/test/conf/cassandra-pem-sslcontextfactory.yaml +++ b/test/conf/cassandra-pem-sslcontextfactory.yaml @@@ -1,151 -1,0 +1,152 @@@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# +# Testing for pluggable ssl_context_factory option for client and server encryption options with a valid and a missing +# implementation classes. +# +cluster_name: Test Cluster +# memtable_allocation_type: heap_buffers +memtable_allocation_type: offheap_objects - commitlog_sync: batch ++commitlog_sync: periodic ++commitlog_sync_period: 10s +commitlog_segment_size: 5MiB +commitlog_directory: build/test/cassandra/commitlog +# commitlog_compression: +# - class_name: LZ4Compressor +cdc_raw_directory: build/test/cassandra/cdc_raw +cdc_enabled: false +hints_directory: build/test/cassandra/hints +partitioner: org.apache.cassandra.dht.ByteOrderedPartitioner +listen_address: 127.0.0.1 +storage_port: 7012 +ssl_storage_port: 17012 +start_native_transport: true +native_transport_port: 9042 +column_index_size: 4KiB +saved_caches_directory: build/test/cassandra/saved_caches +data_file_directories: + - build/test/cassandra/data +disk_access_mode: mmap +seed_provider: + - class_name: org.apache.cassandra.locator.SimpleSeedProvider + parameters: + - seeds: "127.0.0.1:7012" +endpoint_snitch: org.apache.cassandra.locator.SimpleSnitch +dynamic_snitch: true +client_encryption_options: + ssl_context_factory: + class_name: org.apache.cassandra.security.PEMBasedSslContextFactory + parameters: + private_key: | + -----BEGIN ENCRYPTED PRIVATE KEY----- + MIIE6jAcBgoqhkiG9w0BDAEDMA4ECOWqSzq5PBIdAgIFxQSCBMjXsCK30J0aT3J/ + g5kcbmevTOY1pIhJGbf5QYYrMUPiuDK2ydxIbiPzoTE4/S+OkCeHhlqwn/YydpBl + xgjZZ1Z5rLJHO27d2biuESqanDiBVXYuVmHmaifRnFy0uUTFkStB5mjVZEiJgO29 + L83hL60uWru71EVuVriC2WCfmZ/EXp6wyYszOqCFQ8Quk/rDO6XuaBl467MJbx5V + sucGT6E9XKNd9hB14/Izb2jtVM5kqKxoiHpz1na6yhEYJiE5D1uOonznWjBnjwB/ + f0x+acpDfVDoJKTlRdz+DEcbOF7mb9lBVVjP6P/AAsmQzz6JKwHjvCrjYfQmyyN8 + RI4KRQnWgm4L3dtByLqY8HFU4ogisCMCgI+hZQ+OKMz/hoRO540YGiPcTRY3EOUR + 0bd5JxU6tCJDMTqKP9aSL2KmLoiLowdMkSPz7TCzLsZ2bGJemuCfpAs4XT1vXCHs + evrUbOnh8et1IA8mZ9auThfqsZtNagJLEXA6hWIKp1FfVL3Q49wvMKZt4eTn/zwU + tLL0m5yPo6/HAaOA3hbm/oghZS0dseshXl7PZrmZQtvYnIvjyoxEL7ducYDQCDP6 + wZ7Nzyh1QZAauSS15hl3vLFRZCA9hWAVgwQAviTvhB342O0i9qI7TQkcHk+qcTPN + K+iGNbFZ8ma1izXNKSJ2PgI/QqFNIeJWvZrb9PhJRmaZVsTJ9fERm1ewpebZqkVv + zMqMhlKgx9ggAaSKgnGZkwXwB6GrSbbzUrwRCKm3FieD1QE4VVYevaadVUU75GG5 + mrFKorJEH7kFZlic8OTjDksYnHbcgU36XZrGEXa2+ldVeGKL3CsXWciaQRcJg8yo + WQDjZpcutGI0eMJWCqUkv8pYZC2/wZU4htCve5nVJUU4t9uuo9ex7lnwlLWPvheQ + jUBMgzSRsZ+zwaIusvufA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d24xEDAOBgNVBAcTB1Vu + a25vd24xEDAOBgNVBAoTB1Vua25vd24xFDASBgNVBAsMC3NzbF90ZXN0aW5nMRkw + FwYDVQQDExBBcGFjaGUgQ2Fzc2FuZHJhMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A + MIIBCgKCAQEAjkmVX/HS49cS8Hn6o26IGwMIcEV3d7ZhH0GNcx8rnSRd10dU9F6d + ugSjbwGFMcWUQzYNejN6az0Wb8JIQyXRPTWjfgaWTyVGr0bGTnxg6vwhzfI/9jzy + q59xv29OuSY1dxmY31f0pZ9OOw3mabWksjoO2TexfKoxqsRHJ8PrM1f8E84Z4xo2 + TJXGzpuIxRkAJ+sVDqKEAhrKAfRYMSgdJ7zRt8VXv9ngjX20uA2m092NcH0Kmeto + TmuWUtK8E/qcN7ULN8xRWNUn4hu6mG6mayk4XliGRqI1VZupqh+MgNqHznuTd0bA + YrQsFPw9HaZ2hvVnJffJ5l7njAekZNOL+wIDAQABoyEwHzAdBgNVHQ4EFgQUcdiD + N6aylI91kAd34Hl2AzWY51QwDQYJKoZIhvcNAQELBQADggEBAG9q29ilUgCWQP5v + iHkZHj10gXGEoMkdfrPBf8grC7dpUcaw1Qfku/DJ7kPvMALeEsmFDk/t78roeNbh + IYBLJlzI1HZN6VPtpWQGsqxltAy5XN9Xw9mQM/tu70ShgsodGmE1UoW6eE5+/GMv + 6Fg+zLuICPvs2cFNmWUvukN5LW146tJSYCv0Q/rCPB3m9dNQ9pBxrzPUHXw4glwG + qGnGddXmOC+tSW5lDLLG1BRbKv4zxv3UlrtIjqlJtZb/sQMT6WtG2ihAz7SKOBHa + HOWUwuPTetWIuJCKP7P4mWWtmSmjLy+BFX5seNEngn3RzJ2L8uuTJQ/88OsqgGru + n3MVF9w= + -----END CERTIFICATE----- + private_key_password: "cassandra" + trusted_certificates: | + -----BEGIN CERTIFICATE----- + MIIDkTCCAnmgAwIBAgIETxH5JDANBgkqhkiG9w0BAQsFADB5MRAwDgYDVQQGEwdV +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4zxv3UlrtIjqlJtZb/sQMT6WtG2ihAz7SKOBHa + HOWUwuPTetWIuJCKP7P4mWWtmSmjLy+BFX5seNEngn3RzJ2L8uuTJQ/88OsqgGru + n3MVF9w= + -----END CERTIFICATE----- +server_encryption_options: + ssl_context_factory: + class_name: org.apache.cassandra.security.PEMBasedSslContextFactory + internode_encryption: none + keystore: test/conf/cassandra_ssl_test.keystore.pem + keystore_password: cassandra + truststore: test/conf/cassandra_ssl_test.truststore.pem +incremental_backups: true +concurrent_compactors: 4 +compaction_throughput: 0MiB/s +row_cache_class_name: org.apache.cassandra.cache.OHCProvider +row_cache_size: 16MiB +user_defined_functions_enabled: true +scripted_user_defined_functions_enabled: true +prepared_statements_cache_size: 1MiB +corrupted_tombstone_strategy: exception +stream_entire_sstables: true +stream_throughput_outbound: 24MiB/s +sasi_indexes_enabled: true +materialized_views_enabled: true +file_cache_enabled: true diff --cc test/conf/cassandra-seeds.yaml index 1c38f8e1ad,675ac2bf51..722e997ebc --- a/test/conf/cassandra-seeds.yaml +++ b/test/conf/cassandra-seeds.yaml @@@ -5,9 -5,9 +5,9 @@@ cluster_name: Test Cluster # memtable_allocation_type: heap_buffers memtable_allocation_type: offheap_objects - commitlog_sync: batch - commitlog_sync_batch_window_in_ms: 1.0 + commitlog_sync: periodic -commitlog_sync_period_in_ms: 10000 -commitlog_segment_size_in_mb: 5 ++commitlog_sync_period: 10s +commitlog_segment_size: 5MiB commitlog_directory: build/test/cassandra/commitlog cdc_raw_directory: build/test/cassandra/cdc_raw cdc_enabled: false diff --cc test/conf/cassandra-sslcontextfactory-invalidconfiguration.yaml index d3970cbf98,0000000000..ddab645b0e mode 100644,000000..100644 --- a/test/conf/cassandra-sslcontextfactory-invalidconfiguration.yaml +++ b/test/conf/cassandra-sslcontextfactory-invalidconfiguration.yaml @@@ -1,82 -1,0 +1,82 @@@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# +# Testing for pluggable ssl_context_factory option for client and server encryption options with a valid and a missing +# implementation classes. +# +cluster_name: Test Cluster +# memtable_allocation_type: heap_buffers +memtable_allocation_type: offheap_objects - commitlog_sync: batch - commitlog_sync_batch_window_in_ms: 1.0 ++commitlog_sync: periodic ++commitlog_sync_period: 10s +commitlog_segment_size: 5MiB +commitlog_directory: build/test/cassandra/commitlog +# commitlog_compression: +# - class_name: LZ4Compressor +cdc_raw_directory: build/test/cassandra/cdc_raw +cdc_enabled: false +hints_directory: build/test/cassandra/hints +partitioner: org.apache.cassandra.dht.ByteOrderedPartitioner +listen_address: 127.0.0.1 +storage_port: 7012 +ssl_storage_port: 17012 +start_native_transport: true +native_transport_port: 9042 +column_index_size: 4KiB +saved_caches_directory: build/test/cassandra/saved_caches +data_file_directories: + - build/test/cassandra/data +disk_access_mode: mmap +seed_provider: + - class_name: org.apache.cassandra.locator.SimpleSeedProvider + parameters: + - seeds: "127.0.0.1:7012" +endpoint_snitch: org.apache.cassandra.locator.SimpleSnitch +dynamic_snitch: true +client_encryption_options: + ssl_context_factory: + class_name: org.apache.cassandra.security.DummySslContextFactoryImpl + parameters: + key1: "value1" + key2: "value2" + key3: "value3" + truststore: conf/.truststore + truststore_password: cassandra + keystore: conf/.keystore + keystore_password: cassandra +server_encryption_options: + internode_encryption: none + keystore: conf/.keystore + keystore_password: cassandra + truststore: conf/.truststore + truststore_password: cassandra +incremental_backups: true +concurrent_compactors: 4 +compaction_throughput: 0MiB/s +row_cache_class_name: org.apache.cassandra.cache.OHCProvider +row_cache_size: 16MiB +user_defined_functions_enabled: true +scripted_user_defined_functions_enabled: true +prepared_statements_cache_size: 1MiB +corrupted_tombstone_strategy: exception +stream_entire_sstables: true +stream_throughput_outbound: 23841858MiB/s +sasi_indexes_enabled: true +materialized_views_enabled: true +file_cache_enabled: true diff --cc test/conf/cassandra-sslcontextfactory.yaml index fde4bfdc6d,0000000000..934ea9aff5 mode 100644,000000..100644 --- a/test/conf/cassandra-sslcontextfactory.yaml +++ b/test/conf/cassandra-sslcontextfactory.yaml @@@ -1,85 -1,0 +1,85 @@@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# +# Testing for pluggable ssl_context_factory option for client and server encryption options with a valid and a missing +# implementation classes. +# +cluster_name: Test Cluster +# memtable_allocation_type: heap_buffers +memtable_allocation_type: offheap_objects - commitlog_sync: batch - commitlog_sync_batch_window_in_ms: 1.0 ++commitlog_sync: periodic ++commitlog_sync_period: 10s +commitlog_segment_size: 5MiB +commitlog_directory: build/test/cassandra/commitlog +# commitlog_compression: +# - class_name: LZ4Compressor +cdc_raw_directory: build/test/cassandra/cdc_raw +cdc_enabled: false +hints_directory: build/test/cassandra/hints +partitioner: org.apache.cassandra.dht.ByteOrderedPartitioner +listen_address: 127.0.0.1 +storage_port: 7012 +ssl_storage_port: 17012 +start_native_transport: true +native_transport_port: 9042 +column_index_size: 4KiB +saved_caches_directory: build/test/cassandra/saved_caches +data_file_directories: + - build/test/cassandra/data +disk_access_mode: mmap +seed_provider: + - class_name: org.apache.cassandra.locator.SimpleSeedProvider + parameters: + - seeds: "127.0.0.1:7012" +endpoint_snitch: org.apache.cassandra.locator.SimpleSnitch +dynamic_snitch: true +client_encryption_options: + ssl_context_factory: + class_name: org.apache.cassandra.security.DummySslContextFactoryImpl + parameters: + key1: "value1" + key2: "value2" + key3: "value3" + keystore: dummy-keystore +server_encryption_options: + ssl_context_factory: + class_name: org.apache.cassandra.security.MissingSslContextFactoryImpl + parameters: + key1: "value1" + key2: "value2" + key3: "value3" + internode_encryption: none + keystore: conf/.keystore + keystore_password: cassandra + truststore: conf/.truststore + truststore_password: cassandra +incremental_backups: true +concurrent_compactors: 4 +compaction_throughput: 0MiB/s +row_cache_class_name: org.apache.cassandra.cache.OHCProvider +row_cache_size: 16MiB +user_defined_functions_enabled: true +scripted_user_defined_functions_enabled: true +prepared_statements_cache_size: 1MiB +corrupted_tombstone_strategy: exception +stream_entire_sstables: true +stream_throughput_outbound: 23841858MiB/s +sasi_indexes_enabled: true +materialized_views_enabled: true +file_cache_enabled: true diff --cc test/conf/cassandra.yaml index baee08534c,96946709f0..156267e935 --- a/test/conf/cassandra.yaml +++ b/test/conf/cassandra.yaml @@@ -5,9 -5,9 +5,9 @@@ cluster_name: Test Cluster memtable_allocation_type: heap_buffers # memtable_allocation_type: offheap_objects - commitlog_sync: batch - commitlog_sync_batch_window_in_ms: 1.0 + commitlog_sync: periodic -commitlog_sync_period_in_ms: 10000 -commitlog_segment_size_in_mb: 5 ++commitlog_sync_period: 10s +commitlog_segment_size: 5MiB commitlog_directory: build/test/cassandra/commitlog # commitlog_compression: # - class_name: LZ4Compressor diff --cc test/conf/unit-test-conf/test-native-port.yaml index c8ed929cc6,26cd518564..185c4dbbf3 --- a/test/conf/unit-test-conf/test-native-port.yaml +++ b/test/conf/unit-test-conf/test-native-port.yaml @@@ -5,9 -5,9 +5,9 @@@ cluster_name: Test Cluster # memtable_allocation_type: heap_buffers memtable_allocation_type: offheap_objects - commitlog_sync: batch - commitlog_sync_batch_window_in_ms: 1.0 + commitlog_sync: periodic -commitlog_sync_period_in_ms: 10000 -commitlog_segment_size_in_mb: 5 ++commitlog_sync_period: 10s +commitlog_segment_size: 5MiB commitlog_directory: build/test/cassandra/commitlog # commitlog_compression: # - class_name: LZ4Compressor diff --cc test/distributed/org/apache/cassandra/distributed/impl/InstanceConfig.java index d26ec02916,5e4b0a24b3..f170cdbeba --- a/test/distributed/org/apache/cassandra/distributed/impl/InstanceConfig.java +++ b/test/distributed/org/apache/cassandra/distributed/impl/InstanceConfig.java @@@ -99,8 -104,9 +99,9 @@@ public class InstanceConfig implements .set("concurrent_reads", 2) .set("memtable_flush_writers", 1) .set("concurrent_compactors", 1) - .set("memtable_heap_space_in_mb", 10) + .set("memtable_heap_space", "10MiB") - .set("commitlog_sync", "batch") + .set("commitlog_sync", "periodic") + .set("commitlog_sync_period_in_ms", 10000) .set("storage_port", storage_port) .set("native_transport_port", native_transport_port) .set("endpoint_snitch", DistributedTestSnitch.class.getName()) @@@ -110,11 -116,9 +111,9 @@@ .set("diagnostic_events_enabled", true) .set("auto_bootstrap", false) // capacities that are based on `totalMemory` that should be fixed size - .set("index_summary_capacity_in_mb", 50l) - .set("counter_cache_size_in_mb", 50l) - .set("key_cache_size_in_mb", 50l); + .set("index_summary_capacity", "50MiB") + .set("counter_cache_size", "50MiB") - .set("key_cache_size", "50MiB") - // legacy parameters - .forceSet("commitlog_sync_batch_window_in_ms", "1"); ++ .set("key_cache_size", "50MiB"); this.featureFlags = EnumSet.noneOf(Feature.class); this.jmxPort = jmx_port; } diff --cc test/distributed/org/apache/cassandra/distributed/test/ReplicaFilteringProtectionTest.java index 099ea053ae,e919e77e54..5d71f8d111 --- a/test/distributed/org/apache/cassandra/distributed/test/ReplicaFilteringProtectionTest.java +++ b/test/distributed/org/apache/cassandra/distributed/test/ReplicaFilteringProtectionTest.java @@@ -56,8 -56,8 +56,7 @@@ public class ReplicaFilteringProtection { cluster = init(Cluster.build() .withNodes(REPLICAS) -- .withConfig(config -> config.set("hinted_handoff_enabled", false) - .set("commitlog_sync", "batch")).start()); - .set("num_tokens", 1)).start()); ++ .withConfig(config -> config.set("hinted_handoff_enabled", false)).start()); // Make sure we start w/ the correct defaults: cluster.get(1).runOnInstance(() -> assertEquals(DEFAULT_WARN_THRESHOLD, StorageService.instance.getCachedReplicaRowsWarnThreshold())); diff --cc test/simulator/main/org/apache/cassandra/simulator/ClusterSimulation.java index caf642e218,0000000000..0efa0ab93e mode 100644,000000..100644 --- a/test/simulator/main/org/apache/cassandra/simulator/ClusterSimulation.java +++ b/test/simulator/main/org/apache/cassandra/simulator/ClusterSimulation.java @@@ -1,835 -1,0 +1,847 @@@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.cassandra.simulator; + +import java.io.IOException; +import java.lang.reflect.Field; +import java.lang.reflect.Modifier; +import java.nio.file.FileSystem; +import java.util.ArrayList; +import java.util.EnumMap; +import java.util.List; +import java.util.Map; +import java.util.TreeMap; +import java.util.concurrent.Callable; +import java.util.concurrent.CopyOnWriteArrayList; +import java.util.function.Consumer; +import java.util.function.IntSupplier; +import java.util.function.LongConsumer; +import java.util.function.Predicate; +import java.util.function.Supplier; + +import com.google.common.jimfs.Configuration; +import com.google.common.jimfs.Jimfs; +import com.google.common.util.concurrent.AsyncFunction; +import com.google.common.util.concurrent.FutureCallback; + +import org.apache.cassandra.concurrent.ExecutorFactory; +import org.apache.cassandra.config.ParameterizedClass; +import org.apache.cassandra.distributed.Cluster; +import org.apache.cassandra.distributed.api.Feature; +import org.apache.cassandra.distributed.api.IInstance; +import org.apache.cassandra.distributed.api.IInstanceConfig; +import org.apache.cassandra.distributed.api.IInstanceInitializer; +import org.apache.cassandra.distributed.api.IInvokableInstance; +import org.apache.cassandra.distributed.api.IIsolatedExecutor; +import org.apache.cassandra.distributed.api.IIsolatedExecutor.SerializableBiConsumer; +import org.apache.cassandra.distributed.api.IIsolatedExecutor.SerializableConsumer; +import org.apache.cassandra.distributed.api.IIsolatedExecutor.SerializableRunnable; +import org.apache.cassandra.distributed.impl.DirectStreamingConnectionFactory; ++import org.apache.cassandra.distributed.impl.InstanceConfig; +import org.apache.cassandra.distributed.impl.IsolatedExecutor; +import org.apache.cassandra.io.compress.LZ4Compressor; +import org.apache.cassandra.service.paxos.BallotGenerator; +import org.apache.cassandra.service.paxos.PaxosPrepare; +import org.apache.cassandra.simulator.RandomSource.Choices; +import org.apache.cassandra.simulator.asm.InterceptAsClassTransformer; +import org.apache.cassandra.simulator.asm.NemesisFieldSelectors; +import org.apache.cassandra.simulator.cluster.ClusterActions; +import org.apache.cassandra.simulator.cluster.ClusterActions.TopologyChange; +import org.apache.cassandra.simulator.systems.Failures; +import org.apache.cassandra.simulator.systems.InterceptedWait.CaptureSites.Capture; +import org.apache.cassandra.simulator.systems.InterceptibleThread; +import org.apache.cassandra.simulator.systems.InterceptingGlobalMethods; +import org.apache.cassandra.simulator.systems.InterceptingGlobalMethods.ThreadLocalRandomCheck; +import org.apache.cassandra.simulator.systems.InterceptorOfGlobalMethods; +import org.apache.cassandra.simulator.systems.InterceptingExecutorFactory; +import org.apache.cassandra.simulator.systems.InterceptorOfGlobalMethods.IfInterceptibleThread; +import org.apache.cassandra.simulator.systems.NetworkConfig; +import org.apache.cassandra.simulator.systems.NetworkConfig.PhaseConfig; +import org.apache.cassandra.simulator.systems.SchedulerConfig; +import org.apache.cassandra.simulator.systems.SimulatedFutureActionScheduler; +import org.apache.cassandra.simulator.systems.SimulatedSystems; +import org.apache.cassandra.simulator.systems.SimulatedBallots; +import org.apache.cassandra.simulator.systems.SimulatedExecution; +import org.apache.cassandra.simulator.systems.SimulatedFailureDetector; +import org.apache.cassandra.simulator.systems.SimulatedMessageDelivery; +import org.apache.cassandra.simulator.systems.SimulatedSnitch; +import org.apache.cassandra.simulator.systems.SimulatedTime; +import org.apache.cassandra.simulator.utils.ChanceRange; +import org.apache.cassandra.simulator.utils.IntRange; +import org.apache.cassandra.simulator.utils.KindOfSequence; +import org.apache.cassandra.simulator.utils.LongRange; +import org.apache.cassandra.utils.Clock; +import org.apache.cassandra.utils.Closeable; +import org.apache.cassandra.utils.FBUtilities; +import org.apache.cassandra.utils.Throwables; +import org.apache.cassandra.utils.concurrent.Ref; +import org.apache.cassandra.utils.memory.BufferPool; +import org.apache.cassandra.utils.memory.BufferPools; +import org.apache.cassandra.utils.memory.HeapPool; + +import static java.lang.Integer.min; +import static java.util.Collections.emptyMap; +import static java.util.concurrent.TimeUnit.MICROSECONDS; +import static java.util.concurrent.TimeUnit.MILLISECONDS; +import static java.util.concurrent.TimeUnit.NANOSECONDS; +import static java.util.concurrent.TimeUnit.SECONDS; +import static org.apache.cassandra.distributed.impl.AbstractCluster.getSharedClassPredicate; +import static org.apache.cassandra.simulator.SimulatorUtils.failWithOOM; +import static org.apache.cassandra.utils.Shared.Scope.ANY; +import static org.apache.cassandra.utils.Shared.Scope.SIMULATION; + +/** + * Wraps a Cluster and a Simulation to run upon it + */ +@SuppressWarnings("RedundantCast") +public class ClusterSimulation<S extends Simulation> implements AutoCloseable +{ + public static final Class<?>[] SHARE = new Class[] + { + AsyncFunction.class, + FutureCallback.class, + io.netty.util.concurrent.GenericFutureListener.class, + io.netty.channel.FileRegion.class, + io.netty.util.ReferenceCounted.class + }; + + public static final Class<?>[] ISOLATE = new Class<?>[0]; + + public interface SimulationFactory<S extends Simulation> + { + S create(SimulatedSystems simulated, RunnableActionScheduler scheduler, Cluster cluster, ClusterActions.Options options); + } + + public interface SchedulerFactory + { + RunnableActionScheduler create(RandomSource random); + } + + @SuppressWarnings("UnusedReturnValue") + public static abstract class Builder<S extends Simulation> + { + protected Supplier<RandomSource> randomSupplier = RandomSource.Default::new; + protected int uniqueNum = 0; + protected int threadCount; + + protected int concurrency = 10; + protected IntRange nodeCount = new IntRange(4, 16), dcCount = new IntRange(1, 2), + primaryKeySeconds = new IntRange(5, 30), withinKeyConcurrency = new IntRange(2, 5); + protected TopologyChange[] topologyChanges = TopologyChange.values(); + protected int topologyChangeLimit = -1; + + protected int primaryKeyCount; + protected int secondsToSimulate; + + protected ChanceRange normalNetworkDropChance = new ChanceRange(randomSource -> randomSource.qlog2uniformFloat(4), 0f, 0.001f), + normalNetworkDelayChance = new ChanceRange(randomSource -> randomSource.qlog2uniformFloat(4), 0.01f, 0.1f), + flakyNetworkDropChance = new ChanceRange(randomSource -> randomSource.qlog2uniformFloat(4), 0.01f, 0.1f), + flakyNetworkDelayChance = new ChanceRange(randomSource -> randomSource.qlog2uniformFloat(4), 0.01f, 0.1f), + networkPartitionChance = new ChanceRange(randomSource -> randomSource.qlog2uniformFloat(4), 0.0f, 0.1f), + networkFlakyChance = new ChanceRange(randomSource -> randomSource.qlog2uniformFloat(4), 0.0f, 0.1f), + monitorDelayChance = new ChanceRange(randomSource -> randomSource.qlog2uniformFloat(4), 0.01f, 0.1f), + schedulerDelayChance = new ChanceRange(randomSource -> randomSource.qlog2uniformFloat(4), 0.01f, 0.1f), + timeoutChance = new ChanceRange(randomSource -> randomSource.qlog2uniformFloat(4), 0.01f, 0.1f), + readChance = new ChanceRange(RandomSource::uniformFloat, 0.05f, 0.95f), + nemesisChance = new ChanceRange(randomSource -> randomSource.qlog2uniformFloat(4), 0.001f, 0.01f); + + protected LongRange normalNetworkLatencyNanos = new LongRange(1, 2, MILLISECONDS, NANOSECONDS), + normalNetworkDelayNanos = new LongRange(2, 100, MILLISECONDS, NANOSECONDS), + flakyNetworkLatencyNanos = new LongRange(2, 100, MILLISECONDS, NANOSECONDS), + flakyNetworkDelayNanos = new LongRange(2, 100, MILLISECONDS, NANOSECONDS), + networkReconfigureInterval = new LongRange(50, 5000, MICROSECONDS, NANOSECONDS), + schedulerJitterNanos = new LongRange(100, 2000, MICROSECONDS, NANOSECONDS), + schedulerDelayNanos = new LongRange(0, 50, MICROSECONDS, NANOSECONDS), + schedulerLongDelayNanos = new LongRange(50, 5000, MICROSECONDS, NANOSECONDS), + clockDriftNanos = new LongRange(1, 5000, MILLISECONDS, NANOSECONDS), + clockDiscontinuitIntervalNanos = new LongRange(10, 60, SECONDS, NANOSECONDS), + topologyChangeIntervalNanos = new LongRange(5, 15, SECONDS, NANOSECONDS); + + + + protected long contentionTimeoutNanos = MILLISECONDS.toNanos(500L), + writeTimeoutNanos = SECONDS.toNanos(1L), + readTimeoutNanos = SECONDS.toNanos(2L), + requestTimeoutNanos = SECONDS.toNanos(2L); + + protected SchedulerFactory schedulerFactory = schedulerFactory(RunnableActionScheduler.Kind.values()); + + protected Debug debug = new Debug(); + protected Capture capture = new Capture(false, false, false); + protected HeapPool.Logged.Listener memoryListener; + protected SimulatedTime.Listener timeListener = (i1, i2) -> {}; + protected LongConsumer onThreadLocalRandomCheck; + + public Debug debug() + { + return debug; + } + + public Builder<S> debug(EnumMap<Debug.Info, Debug.Levels> debug, int[] primaryKeys) + { + this.debug = new Debug(debug, primaryKeys); + return this; + } + + public Builder<S> unique(int num) + { + this.uniqueNum = num; + return this; + } + + public Builder<S> threadCount(int count) + { + this.threadCount = count; + return this; + } + + public Builder<S> nodes(IntRange range) + { + this.nodeCount = range; + return this; + } + + public Builder<S> nodes(int min, int max) + { + this.nodeCount = new IntRange(min, max); + return this; + } + + public Builder<S> dcs(IntRange range) + { + this.dcCount = range; + return this; + } + + public Builder<S> dcs(int min, int max) + { + this.dcCount = new IntRange(min, max); + return this; + } + + public Builder<S> concurrency(int concurrency) + { + this.concurrency = concurrency; + return this; + } + + public IntRange primaryKeySeconds() + { + return primaryKeySeconds; + } + + public Builder<S> primaryKeySeconds(IntRange range) + { + this.primaryKeySeconds = range; + return this; + } + + public Builder<S> withinKeyConcurrency(IntRange range) + { + this.withinKeyConcurrency = range; + return this; + } + + public Builder<S> withinKeyConcurrency(int min, int max) + { + this.withinKeyConcurrency = new IntRange(min, max); + return this; + } + + public Builder<S> topologyChanges(TopologyChange[] topologyChanges) + { + this.topologyChanges = topologyChanges; + return this; + } + + public Builder<S> topologyChangeIntervalNanos(LongRange topologyChangeIntervalNanos) + { + this.topologyChangeIntervalNanos = topologyChangeIntervalNanos; + return this; + } + + public Builder<S> topologyChangeLimit(int topologyChangeLimit) + { + this.topologyChangeLimit = topologyChangeLimit; + return this; + } + + public int primaryKeyCount() + { + return primaryKeyCount; + } + + public Builder<S> primaryKeyCount(int count) + { + this.primaryKeyCount = count; + return this; + } + + public int secondsToSimulate() + { + return secondsToSimulate; + } + + public Builder<S> secondsToSimulate(int seconds) + { + this.secondsToSimulate = seconds; + return this; + } + + public Builder<S> networkPartitionChance(ChanceRange partitionChance) + { + this.networkPartitionChance = partitionChance; + return this; + } + + public Builder<S> networkFlakyChance(ChanceRange flakyChance) + { + this.networkFlakyChance = flakyChance; + return this; + } + + public Builder<S> networkReconfigureInterval(LongRange reconfigureIntervalNanos) + { + this.networkReconfigureInterval = reconfigureIntervalNanos; + return this; + } + + public Builder<S> networkDropChance(ChanceRange dropChance) + { + this.normalNetworkDropChance = dropChance; + return this; + } + + public Builder<S> networkDelayChance(ChanceRange delayChance) + { + this.normalNetworkDelayChance = delayChance; + return this; + } + + public Builder<S> networkLatencyNanos(LongRange networkLatencyNanos) + { + this.normalNetworkLatencyNanos = networkLatencyNanos; + return this; + } + + public Builder<S> networkDelayNanos(LongRange networkDelayNanos) + { + this.normalNetworkDelayNanos = networkDelayNanos; + return this; + } + + public Builder<S> flakyNetworkDropChance(ChanceRange dropChance) + { + this.flakyNetworkDropChance = dropChance; + return this; + } + + public Builder<S> flakyNetworkDelayChance(ChanceRange delayChance) + { + this.flakyNetworkDelayChance = delayChance; + return this; + } + + public Builder<S> flakyNetworkLatencyNanos(LongRange networkLatencyNanos) + { + this.flakyNetworkLatencyNanos = networkLatencyNanos; + return this; + } + + public Builder<S> flakyNetworkDelayNanos(LongRange networkDelayNanos) + { + this.flakyNetworkDelayNanos = networkDelayNanos; + return this; + } + + public Builder<S> clockDriftNanos(LongRange clockDriftNanos) + { + this.clockDriftNanos = clockDriftNanos; + return this; + } + + public Builder<S> clockDiscontinuityIntervalNanos(LongRange clockDiscontinuityIntervalNanos) + { + this.clockDiscontinuitIntervalNanos = clockDiscontinuityIntervalNanos; + return this; + } + + public Builder<S> schedulerDelayChance(ChanceRange delayChance) + { + this.schedulerDelayChance = delayChance; + return this; + } + + public Builder<S> schedulerJitterNanos(LongRange schedulerJitterNanos) + { + this.schedulerJitterNanos = schedulerJitterNanos; + return this; + } + + public LongRange schedulerJitterNanos() + { + return schedulerJitterNanos; + } + + public Builder<S> schedulerDelayNanos(LongRange schedulerDelayNanos) + { + this.schedulerDelayNanos = schedulerDelayNanos; + return this; + } + + public Builder<S> schedulerLongDelayNanos(LongRange schedulerLongDelayNanos) + { + this.schedulerLongDelayNanos = schedulerLongDelayNanos; + return this; + } + + public Builder<S> timeoutChance(ChanceRange timeoutChance) + { + this.timeoutChance = timeoutChance; + return this; + } + + public ChanceRange readChance() + { + return readChance; + } + + public IntRange withinKeyConcurrency() + { + return withinKeyConcurrency; + } + + public int concurrency() + { + return concurrency; + } + + public Builder<S> readChance(ChanceRange readChance) + { + this.readChance = readChance; + return this; + } + + public Builder<S> nemesisChance(ChanceRange nemesisChance) + { + this.nemesisChance = nemesisChance; + return this; + } + + public Builder<S> scheduler(RunnableActionScheduler.Kind... kinds) + { + this.schedulerFactory = schedulerFactory(kinds); + return this; + } + + public SimulatedFutureActionScheduler futureActionScheduler(int nodeCount, SimulatedTime time, RandomSource random) + { + KindOfSequence kind = Choices.random(random, KindOfSequence.values()) + .choose(random); + return new SimulatedFutureActionScheduler(kind, nodeCount, random, time, + new NetworkConfig(new PhaseConfig(normalNetworkDropChance, normalNetworkDelayChance, normalNetworkLatencyNanos, normalNetworkDelayNanos), + new PhaseConfig(flakyNetworkDropChance, flakyNetworkDelayChance, flakyNetworkLatencyNanos, flakyNetworkDelayNanos), + networkPartitionChance, networkFlakyChance, networkReconfigureInterval), + new SchedulerConfig(schedulerDelayChance, schedulerDelayNanos, schedulerLongDelayNanos)); + } + + static SchedulerFactory schedulerFactory(RunnableActionScheduler.Kind... kinds) + { + return (random) -> { + switch (Choices.random(random, kinds).choose(random)) + { + default: throw new AssertionError(); + case SEQUENTIAL: return new RunnableActionScheduler.Sequential(); + case UNIFORM: return new RunnableActionScheduler.RandomUniform(random); + case RANDOM_WALK: return new RunnableActionScheduler.RandomWalk(random); + } + }; + } + + public Builder<S> scheduler(SchedulerFactory schedulerFactory) + { + this.schedulerFactory = schedulerFactory; + return this; + } + + public Builder<S> random(Supplier<RandomSource> randomSupplier) + { + this.randomSupplier = randomSupplier; + return this; + } + + public Builder<S> memoryListener(HeapPool.Logged.Listener memoryListener) + { + this.memoryListener = memoryListener; + return this; + } + + public Builder<S> timeListener(SimulatedTime.Listener timeListener) + { + this.timeListener = timeListener; + return this; + } + + public Builder<S> capture(Capture capture) + { + this.capture = capture; + return this; + } + + public Capture capture() + { + return capture; + } + + public Builder<S> onThreadLocalRandomCheck(LongConsumer runnable) + { + this.onThreadLocalRandomCheck = runnable; + return this; + } + + public abstract ClusterSimulation<S> create(long seed) throws IOException; + } + + static class ThreadAllocator + { + final RandomSource random; + int clusterPool; // number of threads we have left for the whole cluster + int remainingNodes; // number of nodes we still need to allocate them to + int allocationPool; // threads to allocate for the node we're currently processing + int remainingAllocations; // number of _remaining_ allocations take() assumes we want to evenly allocate threads over + + public ThreadAllocator(RandomSource random, int threadsToAllocate, int betweenNodes) + { + this.random = random; + this.clusterPool = threadsToAllocate; + this.remainingNodes = betweenNodes; + } + + // randomly set the number of threads in various thread pools + IInstanceConfig update(IInstanceConfig config) + { + cycle(); + // allocate in ascending order of max, for take() correctness + return config + .set("memtable_flush_writers", take(1, 1, 2)) + .set("concurrent_compactors", take(1, 1, 4)) + .set("concurrent_writes", take(1, 4)) + .set("concurrent_counter_writes", take(1, 4)) + .set("concurrent_materialized_view_writes", take(1, 4)) + .set("concurrent_reads", take(1, 4)) + .forceSet("available_processors", take(3, 4)); + } + + // begin allocating for a new node + void cycle() + { + assert remainingNodes > 0; + // return unallocated items to the outerPool + clusterPool += allocationPool; + // set the curPool to allocate the next allocationPool size + allocationPool = clusterPool; + remainingAllocations = remainingNodes; + // randomly select the next pool size, subtracting it from the outer pool + allocationPool = take(1, 1); + clusterPool -= allocationPool; + // this is hard-coded to match the sum of the first arguments above + remainingAllocations = 9; + --remainingNodes; + } + + /** + * See {@link #take(int, int, int)} + */ + int take(int times, int min) + { + return take(times, min, allocationPool); + } + + /** + * Allocate a random number of threads between [min..max) + * The allocation is suitable for multiple users of the value, i.e. + * {@code times} multiple of the result are deducted from the pool. + * + * If there are adequate supplies we aim to allocate threads "equally" between pools, + * selecting a uniform value between 0.5x and 2x the fair split of the remaining pool + * on each allocation. If the min/max bounds override that, they are preferred. + * + * The minimum is always honoured, regardless of available pool size. + */ + int take(int times, int min, int max) + { + int remaining = remainingAllocations; + assert remaining >= times; + remainingAllocations -= times; + if (remaining * min <= allocationPool) + return min; + if (times == remaining) + return allocationPool / remaining; + if (times + 1 == remaining) + return random.uniform(Math.max(min, (allocationPool - max) / times), Math.min(max, (allocationPool - min) / times)); + + int median = allocationPool / remaining; + min = Math.max(min, Math.min(max, median) / 2); + max = Math.min(max, median * 2); + return min >= max ? min : random.uniform(min, max); + } + } + + + public final RandomSource random; + public final SimulatedSystems simulated; + public final Cluster cluster; + public final S simulation; + private final FileSystem jimfs; + protected final Map<Integer, List<Closeable>> onUnexpectedShutdown = new TreeMap<>(); + protected final List<Callable<Void>> onShutdown = new CopyOnWriteArrayList<>(); + protected final ThreadLocalRandomCheck threadLocalRandomCheck; + + public ClusterSimulation(RandomSource random, long seed, int uniqueNum, + Builder<?> builder, + Consumer<IInstanceConfig> configUpdater, + SimulationFactory<S> factory) throws IOException + { + this.random = random; + this.jimfs = Jimfs.newFileSystem(Long.toHexString(seed) + 'x' + uniqueNum, Configuration.unix().toBuilder() + .setMaxSize(4L << 30).setBlockSize(512) + .build()); + + final SimulatedMessageDelivery delivery; + final SimulatedExecution execution; + final SimulatedBallots ballots; + final SimulatedSnitch snitch; + final SimulatedTime time; + final SimulatedFailureDetector failureDetector; + + int numOfNodes = builder.nodeCount.select(random); + int numOfDcs = builder.dcCount.select(random, 0, numOfNodes / 4); + int[] numInDcs = new int[numOfDcs]; + int[] nodeToDc = new int[numOfNodes]; + + int[] minRf = new int[numOfDcs], initialRf = new int[numOfDcs], maxRf = new int[numOfDcs]; + { + // TODO (feature): split unevenly + int n = 0, nc = 0; + for (int i = 0; i < numOfDcs; ++i) + { + int numInDc = (numOfNodes / numOfDcs) + (numOfNodes % numOfDcs > i ? 1 : 0); + numInDcs[i] = numInDc; + minRf[i] = 3; + maxRf[i] = min(numInDc, 9); + initialRf[i] = random.uniform(minRf[i], 1 + maxRf[i]); + nc += numInDc; + while (n < nc) + nodeToDc[n++] = i; + } + } + snitch = new SimulatedSnitch(nodeToDc, numInDcs); + + execution = new SimulatedExecution(); + + KindOfSequence kindOfDriftSequence = Choices.uniform(KindOfSequence.values()).choose(random); + KindOfSequence kindOfDiscontinuitySequence = Choices.uniform(KindOfSequence.values()).choose(random); + time = new SimulatedTime(numOfNodes, random, 1577836800000L /*Jan 1st UTC*/, builder.clockDriftNanos, kindOfDriftSequence, + kindOfDiscontinuitySequence.period(builder.clockDiscontinuitIntervalNanos, random), + builder.timeListener); + ballots = new SimulatedBallots(random, () -> { + long max = random.uniform(2, 16); + return () -> random.uniform(1, max); + }); + + Predicate<String> sharedClassPredicate = getSharedClassPredicate(ISOLATE, SHARE, ANY, SIMULATION); + InterceptAsClassTransformer interceptClasses = new InterceptAsClassTransformer(builder.monitorDelayChance.asSupplier(random), builder.nemesisChance.asSupplier(random), NemesisFieldSelectors.get(), ClassLoader.getSystemClassLoader(), sharedClassPredicate.negate()); + threadLocalRandomCheck = new ThreadLocalRandomCheck(builder.onThreadLocalRandomCheck); + + Failures failures = new Failures(); + ThreadAllocator threadAllocator = new ThreadAllocator(random, builder.threadCount, numOfNodes); + cluster = snitch.setup(Cluster.build(numOfNodes) + .withRoot(jimfs.getPath("/cassandra")) + .withSharedClasses(sharedClassPredicate) - .withConfig(config -> configUpdater.accept(threadAllocator.update(config - .with(Feature.BLANK_GOSSIP) - .set("read_request_timeout", String.format("%dms", NANOSECONDS.toMillis(builder.readTimeoutNanos))) - .set("write_request_timeout", String.format("%dms", NANOSECONDS.toMillis(builder.writeTimeoutNanos))) - .set("cas_contention_timeout", String.format("%dms", NANOSECONDS.toMillis(builder.contentionTimeoutNanos))) - .set("request_timeout", String.format("%dms", NANOSECONDS.toMillis(builder.requestTimeoutNanos))) - .set("memtable_heap_space", "1MiB") - .set("memtable_allocation_type", builder.memoryListener != null ? "unslabbed_heap_buffers_logged" : "heap_buffers") - .set("file_cache_size", "16MiB") - .set("use_deterministic_table_id", true) - .set("disk_access_mode", "standard") - .set("failure_detector", SimulatedFailureDetector.Instance.class.getName()) - .set("commitlog_compression", new ParameterizedClass(LZ4Compressor.class.getName(), emptyMap())) - ))) ++ .withConfig(config -> { ++ config.with(Feature.BLANK_GOSSIP) ++ .set("read_request_timeout", String.format("%dms", NANOSECONDS.toMillis(builder.readTimeoutNanos))) ++ .set("write_request_timeout", String.format("%dms", NANOSECONDS.toMillis(builder.writeTimeoutNanos))) ++ .set("cas_contention_timeout", String.format("%dms", NANOSECONDS.toMillis(builder.contentionTimeoutNanos))) ++ .set("request_timeout", String.format("%dms", NANOSECONDS.toMillis(builder.requestTimeoutNanos))) ++ .set("memtable_heap_space", "1MiB") ++ .set("memtable_allocation_type", builder.memoryListener != null ? "unslabbed_heap_buffers_logged" : "heap_buffers") ++ .set("file_cache_size", "16MiB") ++ .set("use_deterministic_table_id", true) ++ .set("disk_access_mode", "standard") ++ .set("failure_detector", SimulatedFailureDetector.Instance.class.getName()) ++ .set("commitlog_compression", new ParameterizedClass(LZ4Compressor.class.getName(), emptyMap())) ++ .set("commitlog_sync", "batch"); ++ ++ // TODO: Add remove() to IInstanceConfig ++ if (config instanceof InstanceConfig) ++ { ++ InstanceConfig instanceConfig = (InstanceConfig) config; ++ instanceConfig.remove("commitlog_sync_period_in_ms"); ++ instanceConfig.remove("commitlog_sync_period"); ++ } ++ ++ configUpdater.accept(threadAllocator.update(config)); ++ }) + .withInstanceInitializer(new IInstanceInitializer() + { + @Override + public void initialise(ClassLoader classLoader, ThreadGroup threadGroup, int num, int generation) + { + List<Closeable> onShutdown = new ArrayList<>(); + InterceptorOfGlobalMethods interceptorOfGlobalMethods = IsolatedExecutor.transferAdhoc((IIsolatedExecutor.SerializableQuadFunction<Capture, LongConsumer, Consumer<Throwable>, RandomSource, InterceptorOfGlobalMethods>) InterceptingGlobalMethods::new, classLoader) + .apply(builder.capture, builder.onThreadLocalRandomCheck, failures, random); + onShutdown.add(interceptorOfGlobalMethods); + + InterceptingExecutorFactory factory = execution.factory(interceptorOfGlobalMethods, classLoader, threadGroup); + IsolatedExecutor.transferAdhoc((SerializableConsumer<ExecutorFactory>) ExecutorFactory.Global::unsafeSet, classLoader) + .accept(factory); + onShutdown.add(factory); + + IsolatedExecutor.transferAdhoc((SerializableBiConsumer<InterceptorOfGlobalMethods, IntSupplier>) InterceptorOfGlobalMethods.Global::unsafeSet, classLoader) + .accept(interceptorOfGlobalMethods, () -> { + if (InterceptibleThread.isDeterministic()) + throw failWithOOM(); + return random.uniform(Integer.MIN_VALUE, Integer.MAX_VALUE); + }); + onShutdown.add(IsolatedExecutor.transferAdhoc((SerializableRunnable)InterceptorOfGlobalMethods.Global::unsafeReset, classLoader)::run); + onShutdown.add(time.setup(num, classLoader)); + + onUnexpectedShutdown.put(num, onShutdown); + } + + @Override + public void beforeStartup(IInstance i) + { + ((IInvokableInstance) i).unsafeAcceptOnThisThread(FBUtilities::setAvailableProcessors, i.config().getInt("available_processors")); + ((IInvokableInstance) i).unsafeAcceptOnThisThread(IfInterceptibleThread::setThreadLocalRandomCheck, (LongConsumer) threadLocalRandomCheck); + + int num = i.config().num(); + if (builder.memoryListener != null) + { + ((IInvokableInstance) i).unsafeAcceptOnThisThread(HeapPool.Logged::setListener, builder.memoryListener); + onUnexpectedShutdown.get(num).add(() -> ((IInvokableInstance) i).unsafeAcceptOnThisThread(HeapPool.Logged::setListener, (ignore1, ignore2) -> {})); + } + + ((IInvokableInstance) i).unsafeAcceptOnThisThread(PaxosPrepare::setOnLinearizabilityViolation, SimulatorUtils::failWithOOM); + onUnexpectedShutdown.get(num).add(() -> ((IInvokableInstance) i).unsafeRunOnThisThread(() -> PaxosPrepare.setOnLinearizabilityViolation(null))); + } + + @Override + public void afterStartup(IInstance i) + { + int num = i.config().num(); + ((IInvokableInstance) i).unsafeAcceptOnThisThread(BallotGenerator.Global::unsafeSet, (BallotGenerator) ballots.get()); + onUnexpectedShutdown.get(num).add(() -> ((IInvokableInstance) i).unsafeRunOnThisThread(() -> BallotGenerator.Global.unsafeSet(new BallotGenerator.Default()))); + + ((IInvokableInstance) i).unsafeAcceptOnThisThread((SerializableConsumer<BufferPool.DebugLeaks>) debug -> BufferPools.forChunkCache().debug(null, debug), failures); + onUnexpectedShutdown.get(num).add(() -> ((IInvokableInstance) i).unsafeRunOnThisThread(() -> BufferPools.forChunkCache().debug(null, null))); + + ((IInvokableInstance) i).unsafeAcceptOnThisThread((SerializableConsumer<BufferPool.DebugLeaks>) debug -> BufferPools.forNetworking().debug(null, debug), failures); + onUnexpectedShutdown.get(num).add(() -> ((IInvokableInstance) i).unsafeRunOnThisThread(() -> BufferPools.forNetworking().debug(null, null))); + + ((IInvokableInstance) i).unsafeAcceptOnThisThread((SerializableConsumer<Ref.OnLeak>) Ref::setOnLeak, failures); + onUnexpectedShutdown.get(num).add(() -> ((IInvokableInstance) i).unsafeRunOnThisThread(() -> Ref.setOnLeak(null))); + } + }).withClassTransformer(interceptClasses) + .withShutdownExecutor((name, classLoader, shuttingDown, call) -> { + onShutdown.add(call); + return null; + }) + ).createWithoutStarting(); + + IfInterceptibleThread.setThreadLocalRandomCheck(threadLocalRandomCheck); + snitch.setup(cluster); + DirectStreamingConnectionFactory.setup(cluster); + delivery = new SimulatedMessageDelivery(cluster); + failureDetector = new SimulatedFailureDetector(cluster); + SimulatedFutureActionScheduler futureActionScheduler = builder.futureActionScheduler(numOfNodes, time, random); + simulated = new SimulatedSystems(random, time, delivery, execution, ballots, failureDetector, snitch, futureActionScheduler, builder.debug, failures); + simulated.register(futureActionScheduler); + + RunnableActionScheduler scheduler = builder.schedulerFactory.create(random); + ClusterActions.Options options = new ClusterActions.Options(builder.topologyChangeLimit, Choices.uniform(KindOfSequence.values()).choose(random).period(builder.topologyChangeIntervalNanos, random), + Choices.random(random, builder.topologyChanges), + minRf, initialRf, maxRf, null); + simulation = factory.create(simulated, scheduler, cluster, options); + } + + public synchronized void close() throws IOException + { + // Re-enable time on shutdown + try + { + Field field = Clock.Global.class.getDeclaredField("instance"); + field.setAccessible(true); + + Field modifiersField = Field.class.getDeclaredField("modifiers"); + modifiersField.setAccessible(true); + modifiersField.setInt(field, field.getModifiers() & ~Modifier.FINAL); + + field.set(null, new Clock.Default()); + } + catch (NoSuchFieldException|IllegalAccessException e) + { + throw new RuntimeException(e); + } + + threadLocalRandomCheck.stop(); + simulated.execution.forceStop(); + SimulatedTime.Global.disable(); + + Throwable fail = null; + for (int num = 1 ; num <= cluster.size() ; ++num) + { + if (!cluster.get(num).isShutdown()) + { + fail = Throwables.close(fail, onUnexpectedShutdown.get(num)); + } + } + + try + { + simulation.close(); + } + catch (Throwable t) + { + fail = t; + } + + try + { + cluster.close(); + } + catch (Throwable t) + { + fail = Throwables.merge(fail, t); + } + for (Callable<Void> call : onShutdown) + { + try + { + call.call(); + } + catch (Throwable t) + { + fail = Throwables.merge(fail, t); + } + } + Throwables.maybeFail(fail, IOException.class); + } +} diff --cc test/unit/org/apache/cassandra/config/FailStartupDuplicateParamsTest.java index 341a0e83ec,0000000000..f14c68b727 mode 100644,000000..100644 --- a/test/unit/org/apache/cassandra/config/FailStartupDuplicateParamsTest.java +++ b/test/unit/org/apache/cassandra/config/FailStartupDuplicateParamsTest.java @@@ -1,163 -1,0 +1,164 @@@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.cassandra.config; + +import java.io.IOException; +import java.net.URL; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.function.Predicate; + +import com.google.common.collect.ImmutableList; +import org.junit.Before; +import org.junit.Test; + +import static org.apache.cassandra.config.CassandraRelevantProperties.ALLOW_DUPLICATE_CONFIG_KEYS; +import static org.apache.cassandra.config.CassandraRelevantProperties.ALLOW_NEW_OLD_CONFIG_KEYS; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + + +public class FailStartupDuplicateParamsTest +{ + private static final List<String> baseConfig = ImmutableList.of( + "cluster_name: Test Cluster", - "commitlog_sync: batch", ++ "commitlog_sync: periodic", ++ "commitlog_sync_period: 10s", + "commitlog_directory: build/test/cassandra/commitlog", + "hints_directory: build/test/cassandra/hints", + "partitioner: org.apache.cassandra.dht.ByteOrderedPartitioner", + "saved_caches_directory: build/test/cassandra/saved_caches", + "data_file_directories:", + " - build/test/cassandra/data", + "seed_provider:" , + " - class_name: org.apache.cassandra.locator.SimpleSeedProvider", + "parameters:", + " - seeds: \"127.0.0.1:7012\"", + "endpoint_snitch: org.apache.cassandra.locator.SimpleSnitch"); + + @Before + public void before() + { + ALLOW_DUPLICATE_CONFIG_KEYS.setBoolean(true); + ALLOW_NEW_OLD_CONFIG_KEYS.setBoolean(false); + } + + @Test + public void testDuplicateParamThrows() throws IOException + { + ALLOW_DUPLICATE_CONFIG_KEYS.setBoolean(false); + testYaml("found duplicate key endpoint_snitch", true, + "endpoint_snitch: org.apache.cassandra.locator.RackInferringSnitch"); + } + + @Test + public void testReplacementDupesOldFirst() throws IOException + { + testYaml("[enable_user_defined_functions -> user_defined_functions_enabled]", true, + "enable_user_defined_functions: true", + "user_defined_functions_enabled: false"); + + testYaml("[enable_user_defined_functions -> user_defined_functions_enabled]", true, + "enable_user_defined_functions: true", + "user_defined_functions_enabled: true"); + } + + @Test + public void testReplacementDupesNewFirst() throws IOException + { + testYaml("[enable_user_defined_functions -> user_defined_functions_enabled]", true, + "user_defined_functions_enabled: false", + "enable_user_defined_functions: true"); + + } + + @Test + public void testReplacementDupesMultiReplace() throws IOException + { + /* + @Replaces(oldName = "internode_socket_send_buffer_size_in_bytes", converter = Converters.BYTES_DATASTORAGE, deprecated = true) + @Replaces(oldName = "internode_send_buff_size_in_bytes", converter = Converters.BYTES_DATASTORAGE, deprecated = true) + public DataStorageSpec internode_socket_send_buffer_size = new DataStorageSpec("0B"); + */ + Predicate<String> predicate = (s) -> s.contains("[internode_send_buff_size_in_bytes -> internode_socket_send_buffer_size]") && + s.contains("[internode_socket_send_buffer_size_in_bytes -> internode_socket_send_buffer_size]"); + String message = " does not contain both [internode_send_buff_size_in_bytes] and [internode_socket_send_buffer_size_in_bytes]"; + + testYaml(predicate, true, + message, + "internode_send_buff_size_in_bytes: 3", + "internode_socket_send_buffer_size_in_bytes: 2", + "internode_socket_send_buffer_size: 5B"); + + // and new first: + testYaml(predicate, true, + message, + "internode_socket_send_buffer_size: 5B", + "internode_socket_send_buffer_size_in_bytes: 2", + "internode_send_buff_size_in_bytes: 3"); + } + + private static void testYaml(String expected, boolean expectFailure, String ... toAdd) throws IOException + { + testYaml((s) -> s.contains(expected), expectFailure, "does not contain [" + expected + ']', toAdd); + } + + private static void testYaml(Predicate<String> exceptionMsgPredicate, boolean expectFailure, String message, String ... toAdd) throws IOException + { + Path p = Files.createTempFile("config_dupes",".yaml"); + try + { + List<String> lines = new ArrayList<>(baseConfig); + Collections.addAll(lines, toAdd); + Files.write(p, lines); + loadConfig(p.toUri().toURL(), message, exceptionMsgPredicate, expectFailure); + } + finally + { + Files.delete(p); + } + } + + private static void loadConfig(URL config, String message, Predicate<String> exceptionMsgPredicate, boolean expectFailure) + { + try + { + new YamlConfigurationLoader().loadConfig(config); + } + catch (Exception e) + { + assertTrue(expectFailure); + e.printStackTrace(System.out); + Throwable t = e; + do + { + if (exceptionMsgPredicate.test(t.getMessage())) + return; + t = t.getCause(); + } while (t != null); + + fail("Message\n["+e.getMessage()+ "]\n"+message); + } + assertFalse(expectFailure); + } +} diff --cc test/unit/org/apache/cassandra/config/LoadOldYAMLBackwardCompatibilityTest.java index 0e028cb161,575f04d432..339c8652ca --- a/test/unit/org/apache/cassandra/config/LoadOldYAMLBackwardCompatibilityTest.java +++ b/test/unit/org/apache/cassandra/config/LoadOldYAMLBackwardCompatibilityTest.java @@@ -42,90 -37,8 +42,90 @@@ public class LoadOldYAMLBackwardCompati public void testConfigurationLoaderBackwardCompatibility() { Config config = DatabaseDescriptor.loadConfig(); - //Confirm parameters were successfully read with the old names from cassandra-old.yaml - assertEquals(5, config.internode_socket_send_buffer_size_in_bytes); - assertEquals(5, config.internode_socket_receive_buffer_size_in_bytes); + + assertEquals(new DurationSpec.IntMillisecondsBound(10800000), config.max_hint_window); + assertEquals(new DurationSpec.IntMillisecondsBound("3h"), config.max_hint_window); + assertEquals(new DurationSpec.LongMillisecondsBound(0), config.native_transport_idle_timeout); + assertEquals(new DurationSpec.LongMillisecondsBound(10000), config.request_timeout); + assertEquals(new DurationSpec.LongMillisecondsBound(5000), config.read_request_timeout); + assertEquals(new DurationSpec.LongMillisecondsBound(10000), config.range_request_timeout); + assertEquals(new DurationSpec.LongMillisecondsBound(2000), config.write_request_timeout); + assertEquals(new DurationSpec.LongMillisecondsBound(5000), config.counter_write_request_timeout); + assertEquals(new DurationSpec.LongMillisecondsBound(1800), config.cas_contention_timeout); + assertEquals(new DurationSpec.LongMillisecondsBound(60000), config.truncate_request_timeout); + assertEquals(new DurationSpec.IntSecondsBound(300), config.streaming_keep_alive_period); + assertEquals(new DurationSpec.LongMillisecondsBound(500), config.slow_query_log_timeout); + assertNull(config.memtable_heap_space); + assertNull(config.memtable_offheap_space); + assertNull( config.repair_session_space); + assertEquals(new DataStorageSpec.IntBytesBound(4194304), config.internode_application_send_queue_capacity); + assertEquals(new DataStorageSpec.IntBytesBound(134217728), config.internode_application_send_queue_reserve_endpoint_capacity); + assertEquals(new DataStorageSpec.IntBytesBound(536870912), config.internode_application_send_queue_reserve_global_capacity); + assertEquals(new DataStorageSpec.IntBytesBound(4194304), config.internode_application_receive_queue_capacity); + assertEquals(new DataStorageSpec.IntBytesBound(134217728), config.internode_application_receive_queue_reserve_endpoint_capacity); + assertEquals(new DataStorageSpec.IntBytesBound(536870912), config.internode_application_receive_queue_reserve_global_capacity); + assertEquals(new DurationSpec.IntMillisecondsBound(2000), config.internode_tcp_connect_timeout); + assertEquals(new DurationSpec.IntMillisecondsBound(30000), config.internode_tcp_user_timeout); + assertEquals(new DurationSpec.IntMillisecondsBound(300000), config.internode_streaming_tcp_user_timeout); + assertEquals(new DataStorageSpec.IntMebibytesBound(16), config.native_transport_max_frame_size); + assertEquals(new DataStorageSpec.IntMebibytesBound(256), config.max_value_size); + assertEquals(new DataStorageSpec.IntKibibytesBound(4), config.column_index_size); + assertEquals(new DataStorageSpec.IntKibibytesBound(2), config.column_index_cache_size); + assertEquals(new DataStorageSpec.IntKibibytesBound(5), config.batch_size_warn_threshold); + assertEquals(new DataRateSpec.LongBytesPerSecondBound(64, DataRateSpec.DataRateUnit.MEBIBYTES_PER_SECOND), config.compaction_throughput); + assertEquals(new DataStorageSpec.IntMebibytesBound(50), config.min_free_space_per_drive); + assertEquals(new DataRateSpec.LongBytesPerSecondBound(25000000000000L).toString(), config.stream_throughput_outbound.toString()); + assertEquals(DataRateSpec.LongBytesPerSecondBound.megabitsPerSecondInBytesPerSecond(200000000), config.stream_throughput_outbound); + assertEquals(new DataRateSpec.LongBytesPerSecondBound(24L * 1024L * 1024L), config.inter_dc_stream_throughput_outbound); + assertNull(config.commitlog_total_space); + assertEquals(new DurationSpec.IntMillisecondsBound(0.0, TimeUnit.MILLISECONDS), config.commitlog_sync_group_window); - assertEquals(new DurationSpec.IntMillisecondsBound(0), config.commitlog_sync_period); ++ assertEquals(new DurationSpec.IntMillisecondsBound(10000), config.commitlog_sync_period); + assertEquals(new DataStorageSpec.IntMebibytesBound(5), config.commitlog_segment_size); + assertNull(config.periodic_commitlog_sync_lag_block); //Integer + assertNull(config.max_mutation_size); + assertEquals(new DataStorageSpec.IntMebibytesBound(0), config.cdc_total_space); + assertEquals(new DurationSpec.IntMillisecondsBound(250), config.cdc_free_space_check_interval); + assertEquals(new DurationSpec.IntMillisecondsBound(100), config.dynamic_snitch_update_interval); + assertEquals(new DurationSpec.IntMillisecondsBound(600000), config.dynamic_snitch_reset_interval); + assertEquals(new DataStorageSpec.IntKibibytesBound(1024), config.hinted_handoff_throttle); + assertEquals(new DataStorageSpec.IntKibibytesBound(1024), config.batchlog_replay_throttle); + assertEquals(new DurationSpec.IntMillisecondsBound(10000), config.hints_flush_period); + assertEquals(new DataStorageSpec.IntMebibytesBound(128), config.max_hints_file_size); + assertEquals(new DataStorageSpec.IntKibibytesBound(10240), config.trickle_fsync_interval); + assertEquals(new DataStorageSpec.IntMebibytesBound(50), config.sstable_preemptive_open_interval); + assertNull( config.key_cache_size); + assertEquals(new DataStorageSpec.LongMebibytesBound(16), config.row_cache_size); + assertNull(config.counter_cache_size); + assertNull(config.networking_cache_size); + assertNull(config.file_cache_size); + assertNull(config.index_summary_capacity); + assertEquals(new DurationSpec.IntMillisecondsBound(200), config.gc_log_threshold); + assertEquals(new DurationSpec.IntMillisecondsBound(1000), config.gc_warn_threshold); + assertEquals(new DurationSpec.IntSecondsBound(86400), config.trace_type_query_ttl); + assertEquals(new DurationSpec.IntSecondsBound(604800), config.trace_type_repair_ttl); + 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); + assertTrue(config.sasi_indexes_enabled); + assertTrue(config.drop_compact_storage_enabled); + assertTrue(config.user_defined_functions_threads_enabled); + assertEquals(new DurationSpec.IntMillisecondsBound(2000), config.permissions_validity); + assertNull(config.permissions_update_interval); + assertEquals(new DurationSpec.IntMillisecondsBound(2000), config.roles_validity); + assertNull(config.roles_update_interval); + assertEquals(new DurationSpec.IntMillisecondsBound(2000), config.credentials_validity); + assertNull(config.credentials_update_interval); + assertEquals(new DurationSpec.IntMinutesBound(60), config.index_summary_resize_interval); + + //parameters which names have not changed with CASSANDRA-15234 + assertEquals(DurationSpec.IntSecondsBound.inSecondsString("14400"), config.key_cache_save_period); + assertEquals(DurationSpec.IntSecondsBound.inSecondsString("14400s"), config.key_cache_save_period); + assertEquals(new DurationSpec.IntSecondsBound(4, TimeUnit.HOURS), config.key_cache_save_period); + assertEquals(DurationSpec.IntSecondsBound.inSecondsString("0"), config.row_cache_save_period); + assertEquals(new DurationSpec.IntSecondsBound(0), config.row_cache_save_period); + assertEquals(new DurationSpec.IntSecondsBound(2, TimeUnit.HOURS), config.counter_cache_save_period); + assertEquals(new DurationSpec.IntSecondsBound(35), config.cache_load_timeout); } } diff --cc test/unit/org/apache/cassandra/config/ParseAndConvertUnitsTest.java index a21f235524,0000000000..3975f8a442 mode 100644,000000..100644 --- a/test/unit/org/apache/cassandra/config/ParseAndConvertUnitsTest.java +++ b/test/unit/org/apache/cassandra/config/ParseAndConvertUnitsTest.java @@@ -1,119 -1,0 +1,119 @@@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.cassandra.config; + +import org.junit.BeforeClass; +import org.junit.Test; + +import static org.apache.cassandra.config.DataStorageSpec.DataStorageUnit.MEBIBYTES; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; + +public class ParseAndConvertUnitsTest +{ + @BeforeClass + public static void setupDatabaseDescriptor() + { + DatabaseDescriptor.daemonInitialization(); + } + + // CASSANDRA-15234 + @Test + public void testConfigurationLoaderParser() + { + Config config = DatabaseDescriptor.loadConfig(); + + //Confirm duration parameters were successfully parsed with the default values in cassandra.yaml + assertEquals(new DurationSpec.IntMillisecondsBound(10800000), config.max_hint_window); + assertEquals(new DurationSpec.LongMillisecondsBound(0), config.native_transport_idle_timeout); + assertEquals(new DurationSpec.LongMillisecondsBound(10000), config.request_timeout); + assertEquals(new DurationSpec.LongMillisecondsBound(5000), config.read_request_timeout); + assertEquals(new DurationSpec.LongMillisecondsBound(10000), config.range_request_timeout); + assertEquals(new DurationSpec.LongMillisecondsBound(2000), config.write_request_timeout); + assertEquals(new DurationSpec.LongMillisecondsBound(5000), config.counter_write_request_timeout); + assertEquals(new DurationSpec.LongMillisecondsBound(1800), config.cas_contention_timeout); + assertEquals(new DurationSpec.LongMillisecondsBound(60000), config.truncate_request_timeout); + assertEquals(new DurationSpec.IntSecondsBound(300), config.streaming_keep_alive_period); + assertEquals(new DurationSpec.LongMillisecondsBound(500), config.slow_query_log_timeout); + assertEquals(new DurationSpec.IntMillisecondsBound(2000), config.internode_tcp_connect_timeout); + assertEquals(new DurationSpec.IntMillisecondsBound(30000), config.internode_tcp_user_timeout); + assertEquals(new DurationSpec.IntMillisecondsBound(0), config.commitlog_sync_group_window); - assertEquals(new DurationSpec.IntMillisecondsBound(0), config.commitlog_sync_period); ++ assertEquals(new DurationSpec.IntMillisecondsBound(10000), config.commitlog_sync_period); + assertNull(config.periodic_commitlog_sync_lag_block); + assertEquals(new DurationSpec.IntMillisecondsBound(250), config.cdc_free_space_check_interval); + assertEquals(new DurationSpec.IntMillisecondsBound(100), config.dynamic_snitch_update_interval); + assertEquals(new DurationSpec.IntMillisecondsBound(600000), config.dynamic_snitch_reset_interval); + assertEquals(new DurationSpec.IntMillisecondsBound(200), config.gc_log_threshold); + assertEquals(new DurationSpec.IntMillisecondsBound(10000), config.hints_flush_period); + assertEquals(new DurationSpec.IntMillisecondsBound(1000), config.gc_warn_threshold); + assertEquals(new DurationSpec.IntSecondsBound(86400), config.trace_type_query_ttl); + assertEquals(new DurationSpec.IntSecondsBound(604800), config.trace_type_repair_ttl); + assertEquals(new DurationSpec.IntMillisecondsBound(2000), config.permissions_validity); + assertNull(config.permissions_update_interval); + assertEquals(new DurationSpec.IntMillisecondsBound(2000), config.roles_validity); + assertNull(config.roles_update_interval); + assertEquals(new DurationSpec.IntMillisecondsBound(2000), config.credentials_validity); + assertNull(config.credentials_update_interval); + assertEquals(new DurationSpec.IntMinutesBound(60), config.index_summary_resize_interval); + assertEquals(DurationSpec.IntSecondsBound.inSecondsString("4h"), config.key_cache_save_period); + assertEquals(new DurationSpec.IntSecondsBound(30), config.cache_load_timeout); + assertEquals(new DurationSpec.LongMillisecondsBound(1500), config.user_defined_functions_fail_timeout); + assertEquals(new DurationSpec.LongMillisecondsBound(500), config.user_defined_functions_warn_timeout); + assertEquals(new DurationSpec.IntSecondsBound(3600), config.validation_preview_purge_head_start); + + //Confirm space parameters were successfully parsed with the default values in cassandra.yaml + assertNull(config.memtable_heap_space); + assertNull(config.memtable_offheap_space); + assertNull(config.repair_session_space); //null everywhere so should be correct, let's check whether it will bomb + assertEquals(new DataStorageSpec.IntBytesBound(4194304), config.internode_application_send_queue_capacity); + assertEquals(new DataStorageSpec.IntBytesBound(134217728), config.internode_application_send_queue_reserve_endpoint_capacity); + assertEquals(new DataStorageSpec.IntBytesBound(536870912), config.internode_application_send_queue_reserve_global_capacity); + assertEquals(new DataStorageSpec.IntBytesBound(4194304), config.internode_application_receive_queue_capacity); + assertEquals(new DataStorageSpec.IntBytesBound(134217728), config.internode_application_receive_queue_reserve_endpoint_capacity); + assertEquals(new DataStorageSpec.IntBytesBound(536870912), config.internode_application_receive_queue_reserve_global_capacity); + assertEquals(new DataStorageSpec.IntMebibytesBound(16), config.native_transport_max_frame_size); + assertEquals(new DataStorageSpec.IntMebibytesBound(256), config.max_value_size); + assertEquals(new DataStorageSpec.IntKibibytesBound(4), config.column_index_size); + assertEquals(new DataStorageSpec.IntKibibytesBound(2), config.column_index_cache_size); + assertEquals(new DataStorageSpec.IntKibibytesBound(5), config.batch_size_warn_threshold); + assertEquals(new DataStorageSpec.IntKibibytesBound(50), config.batch_size_fail_threshold); + assertEquals(new DataStorageSpec.IntMebibytesBound(100), config.compaction_large_partition_warning_threshold); + assertNull(config.commitlog_total_space); + assertEquals(new DataStorageSpec.IntMebibytesBound(5), config.commitlog_segment_size); + assertNull(config.max_mutation_size); //not set explicitly in the default yaml, check the config; not set there too + assertEquals(new DataStorageSpec.IntMebibytesBound(0), config.cdc_total_space); + assertEquals(new DataStorageSpec.IntKibibytesBound(1024), config.hinted_handoff_throttle); + assertEquals(new DataStorageSpec.IntKibibytesBound(1024), config.batchlog_replay_throttle); + assertEquals(new DataStorageSpec.IntKibibytesBound(10240), config.trickle_fsync_interval); + assertEquals(new DataStorageSpec.IntMebibytesBound(50), config.sstable_preemptive_open_interval); + assertNull(config.counter_cache_size); + assertNull(config.file_cache_size); + assertNull(config.index_summary_capacity); + assertEquals(new DataStorageSpec.LongMebibytesBound(1), config.prepared_statements_cache_size); + assertNull(config.key_cache_size); + assertEquals(new DataStorageSpec.LongMebibytesBound(16), config.row_cache_size); + assertNull(config.native_transport_max_request_data_in_flight); + assertNull(config.native_transport_max_request_data_in_flight_per_ip); + assertEquals(new DataStorageSpec.IntBytesBound(1, MEBIBYTES), config.native_transport_receive_queue_capacity); + + //Confirm rate parameters were successfully parsed with the default values in cassandra.yaml + assertEquals(new DataRateSpec.LongBytesPerSecondBound(0), config.compaction_throughput); + assertEquals(new DataRateSpec.LongBytesPerSecondBound(23841858, DataRateSpec.DataRateUnit.MEBIBYTES_PER_SECOND), config.stream_throughput_outbound); + assertEquals(new DataRateSpec.LongBytesPerSecondBound(24, DataRateSpec.DataRateUnit.MEBIBYTES_PER_SECOND), config.inter_dc_stream_throughput_outbound); + } +} diff --cc test/unit/org/apache/cassandra/cql3/CQLTester.java index 9f01746393,48fddec68a..61bb4839b8 --- a/test/unit/org/apache/cassandra/cql3/CQLTester.java +++ b/test/unit/org/apache/cassandra/cql3/CQLTester.java @@@ -319,12 -278,9 +327,9 @@@ public abstract class CQLTeste { System.setProperty("cassandra.superuser_setup_delay_ms", "0"); - if (ROW_CACHE_SIZE_IN_MB > 0) - DatabaseDescriptor.setRowCacheSizeInMB(ROW_CACHE_SIZE_IN_MB); + if (ROW_CACHE_SIZE_IN_MIB > 0) + DatabaseDescriptor.setRowCacheSizeInMiB(ROW_CACHE_SIZE_IN_MIB); StorageService.instance.setPartitionerUnsafe(Murmur3Partitioner.instance); - - // Once per-JVM is enough - prepareServer(); } @AfterClass --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
