diff --git a/CHANGES.txt b/CHANGES.txt index 4bec8fe7bc..0f8d48e83b 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -6,6 +6,7 @@ * 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 --git a/test/conf/cassandra-murmur.yaml b/test/conf/cassandra-murmur.yaml index c0c2ae71f6..93043b0749 100644 --- a/test/conf/cassandra-murmur.yaml +++ b/test/conf/cassandra-murmur.yaml @@ -4,8 +4,8 @@ # 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: 10s commitlog_segment_size: 5MiB commitlog_directory: build/test/cassandra/commitlog cdc_raw_directory: build/test/cassandra/cdc_raw diff --git a/test/conf/cassandra-old.yaml b/test/conf/cassandra-old.yaml index 86983acc9e..e63a11c49a 100644 --- a/test/conf/cassandra-old.yaml +++ b/test/conf/cassandra-old.yaml @@ -5,8 +5,8 @@ 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: diff --git a/test/conf/cassandra-pem-jks-sslcontextfactory.yaml b/test/conf/cassandra-pem-jks-sslcontextfactory.yaml index 1f10e6c203..1fbc1b2e79 100644 --- a/test/conf/cassandra-pem-jks-sslcontextfactory.yaml +++ b/test/conf/cassandra-pem-jks-sslcontextfactory.yaml @@ -23,7 +23,8 @@ 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: diff --git a/test/conf/cassandra-pem-sslcontextfactory-invalidconfiguration.yaml b/test/conf/cassandra-pem-sslcontextfactory-invalidconfiguration.yaml index 8c7d910f49..b833d1c949 100644 --- a/test/conf/cassandra-pem-sslcontextfactory-invalidconfiguration.yaml +++ b/test/conf/cassandra-pem-sslcontextfactory-invalidconfiguration.yaml @@ -23,7 +23,8 @@ 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: diff --git a/test/conf/cassandra-pem-sslcontextfactory-mismatching-passwords.yaml b/test/conf/cassandra-pem-sslcontextfactory-mismatching-passwords.yaml index 5d64354208..e4ecef5568 100644 --- a/test/conf/cassandra-pem-sslcontextfactory-mismatching-passwords.yaml +++ b/test/conf/cassandra-pem-sslcontextfactory-mismatching-passwords.yaml @@ -23,7 +23,8 @@ 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: diff --git a/test/conf/cassandra-pem-sslcontextfactory-unencryptedkeys.yaml b/test/conf/cassandra-pem-sslcontextfactory-unencryptedkeys.yaml index 7b08bcce03..3228ed0163 100644 --- a/test/conf/cassandra-pem-sslcontextfactory-unencryptedkeys.yaml +++ b/test/conf/cassandra-pem-sslcontextfactory-unencryptedkeys.yaml @@ -23,7 +23,8 @@ 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: diff --git a/test/conf/cassandra-pem-sslcontextfactory.yaml b/test/conf/cassandra-pem-sslcontextfactory.yaml index 26d0f1f998..f037125041 100644 --- a/test/conf/cassandra-pem-sslcontextfactory.yaml +++ b/test/conf/cassandra-pem-sslcontextfactory.yaml @@ -23,7 +23,8 @@ 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: diff --git a/test/conf/cassandra-seeds.yaml b/test/conf/cassandra-seeds.yaml index 1c38f8e1ad..722e997ebc 100644 --- a/test/conf/cassandra-seeds.yaml +++ b/test/conf/cassandra-seeds.yaml @@ -5,8 +5,8 @@ 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 cdc_raw_directory: build/test/cassandra/cdc_raw diff --git a/test/conf/cassandra-sslcontextfactory-invalidconfiguration.yaml b/test/conf/cassandra-sslcontextfactory-invalidconfiguration.yaml index d3970cbf98..ddab645b0e 100644 --- a/test/conf/cassandra-sslcontextfactory-invalidconfiguration.yaml +++ b/test/conf/cassandra-sslcontextfactory-invalidconfiguration.yaml @@ -23,8 +23,8 @@ 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: diff --git a/test/conf/cassandra-sslcontextfactory.yaml b/test/conf/cassandra-sslcontextfactory.yaml index fde4bfdc6d..934ea9aff5 100644 --- a/test/conf/cassandra-sslcontextfactory.yaml +++ b/test/conf/cassandra-sslcontextfactory.yaml @@ -23,8 +23,8 @@ 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: diff --git a/test/conf/cassandra.yaml b/test/conf/cassandra.yaml index baee08534c..156267e935 100644 --- a/test/conf/cassandra.yaml +++ b/test/conf/cassandra.yaml @@ -5,8 +5,8 @@ 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: diff --git a/test/conf/unit-test-conf/test-native-port.yaml b/test/conf/unit-test-conf/test-native-port.yaml index c8ed929cc6..185c4dbbf3 100644 --- a/test/conf/unit-test-conf/test-native-port.yaml +++ b/test/conf/unit-test-conf/test-native-port.yaml @@ -5,8 +5,8 @@ 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: diff --git a/test/distributed/org/apache/cassandra/distributed/impl/InstanceConfig.java b/test/distributed/org/apache/cassandra/distributed/impl/InstanceConfig.java index d26ec02916..f170cdbeba 100644 --- a/test/distributed/org/apache/cassandra/distributed/impl/InstanceConfig.java +++ b/test/distributed/org/apache/cassandra/distributed/impl/InstanceConfig.java @@ -100,7 +100,8 @@ public class InstanceConfig implements IInstanceConfig .set("memtable_flush_writers", 1) .set("concurrent_compactors", 1) .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()) @@ -112,9 +113,7 @@ public class InstanceConfig implements IInstanceConfig // capacities that are based on `totalMemory` that should be fixed size .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 --git a/test/distributed/org/apache/cassandra/distributed/test/RepairBoundaryTest.java b/test/distributed/org/apache/cassandra/distributed/test/RepairBoundaryTest.java index d7cd0ec3fc..b4b77886d2 100644 --- a/test/distributed/org/apache/cassandra/distributed/test/RepairBoundaryTest.java +++ b/test/distributed/org/apache/cassandra/distributed/test/RepairBoundaryTest.java @@ -164,7 +164,6 @@ public class RepairBoundaryTest extends TestBaseImpl { cluster = Cluster.build(3) .withConfig(config -> config.set("hinted_handoff_enabled", false) - .set("commitlog_sync_batch_window_in_ms", 5) .set("num_tokens", 1) .set("initial_token", Long.toString(config.num() * 1000)) .with(NETWORK) diff --git a/test/distributed/org/apache/cassandra/distributed/test/RepairTest.java b/test/distributed/org/apache/cassandra/distributed/test/RepairTest.java index 669e762c10..857c05eeb4 100644 --- a/test/distributed/org/apache/cassandra/distributed/test/RepairTest.java +++ b/test/distributed/org/apache/cassandra/distributed/test/RepairTest.java @@ -89,7 +89,6 @@ public class RepairTest extends TestBaseImpl { configModifier = configModifier.andThen( config -> config.set("hinted_handoff_enabled", false) - .set("commitlog_sync_batch_window_in_ms", 5) .with(NETWORK) .with(GOSSIP) ); diff --git a/test/distributed/org/apache/cassandra/distributed/test/ReplicaFilteringProtectionTest.java b/test/distributed/org/apache/cassandra/distributed/test/ReplicaFilteringProtectionTest.java index 099ea053ae..5d71f8d111 100644 --- a/test/distributed/org/apache/cassandra/distributed/test/ReplicaFilteringProtectionTest.java +++ b/test/distributed/org/apache/cassandra/distributed/test/ReplicaFilteringProtectionTest.java @@ -56,8 +56,7 @@ public class ReplicaFilteringProtectionTest extends TestBaseImpl { cluster = init(Cluster.build() .withNodes(REPLICAS) - .withConfig(config -> config.set("hinted_handoff_enabled", false) - .set("commitlog_sync", "batch")).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 --git a/test/simulator/main/org/apache/cassandra/simulator/ClusterSimulation.java b/test/simulator/main/org/apache/cassandra/simulator/ClusterSimulation.java index caf642e218..0efa0ab93e 100644 --- a/test/simulator/main/org/apache/cassandra/simulator/ClusterSimulation.java +++ b/test/simulator/main/org/apache/cassandra/simulator/ClusterSimulation.java @@ -53,6 +53,7 @@ import org.apache.cassandra.distributed.api.IIsolatedExecutor.SerializableBiCons 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; @@ -673,20 +674,31 @@ public class ClusterSimulation implements AutoCloseable 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 diff --git a/test/unit/org/apache/cassandra/config/FailStartupDuplicateParamsTest.java b/test/unit/org/apache/cassandra/config/FailStartupDuplicateParamsTest.java index 341a0e83ec..f14c68b727 100644 --- a/test/unit/org/apache/cassandra/config/FailStartupDuplicateParamsTest.java +++ b/test/unit/org/apache/cassandra/config/FailStartupDuplicateParamsTest.java @@ -42,7 +42,8 @@ public class FailStartupDuplicateParamsTest { private static final List 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", diff --git a/test/unit/org/apache/cassandra/config/LoadOldYAMLBackwardCompatibilityTest.java b/test/unit/org/apache/cassandra/config/LoadOldYAMLBackwardCompatibilityTest.java index 0e028cb161..339c8652ca 100644 --- a/test/unit/org/apache/cassandra/config/LoadOldYAMLBackwardCompatibilityTest.java +++ b/test/unit/org/apache/cassandra/config/LoadOldYAMLBackwardCompatibilityTest.java @@ -79,7 +79,7 @@ public class LoadOldYAMLBackwardCompatibilityTest 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); diff --git a/test/unit/org/apache/cassandra/config/ParseAndConvertUnitsTest.java b/test/unit/org/apache/cassandra/config/ParseAndConvertUnitsTest.java index a21f235524..3975f8a442 100644 --- a/test/unit/org/apache/cassandra/config/ParseAndConvertUnitsTest.java +++ b/test/unit/org/apache/cassandra/config/ParseAndConvertUnitsTest.java @@ -53,7 +53,7 @@ public class ParseAndConvertUnitsTest 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); diff --git a/test/unit/org/apache/cassandra/cql3/CQLTester.java b/test/unit/org/apache/cassandra/cql3/CQLTester.java index 9f01746393..61bb4839b8 100644 --- a/test/unit/org/apache/cassandra/cql3/CQLTester.java +++ b/test/unit/org/apache/cassandra/cql3/CQLTester.java @@ -316,15 +316,20 @@ public abstract class CQLTester @BeforeClass public static void setUpClass() + { + prePrepareServer(); + + // Once per-JVM is enough + prepareServer(); + } + + protected static void prePrepareServer() { System.setProperty("cassandra.superuser_setup_delay_ms", "0"); 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 diff --git a/test/unit/org/apache/cassandra/db/commitlog/CommitLogReaderTest.java b/test/unit/org/apache/cassandra/db/commitlog/CommitLogReaderTest.java index 02ce3f6438..23440ebfa8 100644 --- a/test/unit/org/apache/cassandra/db/commitlog/CommitLogReaderTest.java +++ b/test/unit/org/apache/cassandra/db/commitlog/CommitLogReaderTest.java @@ -44,10 +44,17 @@ import org.apache.cassandra.utils.KillerForTests; public class CommitLogReaderTest extends CQLTester { @BeforeClass - public static void beforeClass() + public static void setUpClass() { + prePrepareServer(); + DatabaseDescriptor.setCommitFailurePolicy(Config.CommitFailurePolicy.ignore); JVMStabilityInspector.replaceKiller(new KillerForTests(false)); + + DatabaseDescriptor.setCommitLogSync(Config.CommitLogSync.batch); + + // Once per-JVM is enough + prepareServer(); } @Before