diff --git a/src/java/org/apache/cassandra/config/DatabaseDescriptor.java b/src/java/org/apache/cassandra/config/DatabaseDescriptor.java index 9a545811a3..eeea33ab49 100644 --- a/src/java/org/apache/cassandra/config/DatabaseDescriptor.java +++ b/src/java/org/apache/cassandra/config/DatabaseDescriptor.java @@ -290,15 +290,6 @@ public class DatabaseDescriptor logger.info("Global memtable off-heap threshold is disabled, HeapAllocator will be used instead"); else logger.info("Global memtable off-heap threshold is enabled at {}MB", conf.memtable_offheap_space_in_mb); - if (conf.memtable_cleanup_threshold < 0.01f) - throw new ConfigurationException("memtable_cleanup_threshold must be >= 0.01"); - if (conf.memtable_cleanup_threshold > 0.99f) - throw new ConfigurationException("memtable_cleanup_threshold must be <= 0.99"); - if (conf.memtable_cleanup_threshold < 0.1f) - logger.warn("memtable_cleanup_threshold is set very low, which may cause performance degradation"); - - if (conf.memtable_flush_writers < 1) - throw new ConfigurationException("memtable_flush_writers must be at least 1"); /* Local IP, hostname or interface to bind services to */ if (conf.listen_address != null && conf.listen_interface != null) @@ -525,9 +516,19 @@ public class DatabaseDescriptor if (conf.memtable_flush_writers == null) conf.memtable_flush_writers = Math.min(8, Math.max(2, Math.min(FBUtilities.getAvailableProcessors(), conf.data_file_directories.length))); + if (conf.memtable_flush_writers < 1) + throw new ConfigurationException("memtable_flush_writers must be at least 1"); + if (conf.memtable_cleanup_threshold == null) conf.memtable_cleanup_threshold = (float) (1.0 / (1 + conf.memtable_flush_writers)); + if (conf.memtable_cleanup_threshold < 0.01f) + throw new ConfigurationException("memtable_cleanup_threshold must be >= 0.01"); + if (conf.memtable_cleanup_threshold > 0.99f) + throw new ConfigurationException("memtable_cleanup_threshold must be <= 0.99"); + if (conf.memtable_cleanup_threshold < 0.1f) + logger.warn("memtable_cleanup_threshold is set very low, which may cause performance degradation"); + if (conf.concurrent_compactors == null) conf.concurrent_compactors = Math.min(8, Math.max(2, Math.min(FBUtilities.getAvailableProcessors(), conf.data_file_directories.length)));