Fix overflow of memtable_total_space_in_mb patch by Benedict Elliott Smith; reviewed by jbellis for CASSANDRA-6753
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/0510d4e5 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/0510d4e5 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/0510d4e5 Branch: refs/heads/trunk Commit: 0510d4e5b9862ee46be67581334a6f98d066b7ab Parents: a53d531 Author: Jonathan Ellis <[email protected]> Authored: Sat Feb 22 08:24:18 2014 -0600 Committer: Jonathan Ellis <[email protected]> Committed: Sat Feb 22 08:24:18 2014 -0600 ---------------------------------------------------------------------- CHANGES.txt | 1 + .../org/apache/cassandra/config/DatabaseDescriptor.java | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/0510d4e5/CHANGES.txt ---------------------------------------------------------------------- diff --git a/CHANGES.txt b/CHANGES.txt index 2b07926..b1fedd2 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,4 +1,5 @@ 2.1.0-beta2 + * Fix overflow of memtable_total_space_in_mb (CASSANDRA-6573) * Fix ABTC NPE (CASSANDRA-6692) * Allow nodetool to use a file or prompt for password (CASSANDRA-6660) * Fix AIOOBE when concurrently accessing ABSC (CASSANDRA-6742) http://git-wip-us.apache.org/repos/asf/cassandra/blob/0510d4e5/src/java/org/apache/cassandra/config/DatabaseDescriptor.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/config/DatabaseDescriptor.java b/src/java/org/apache/cassandra/config/DatabaseDescriptor.java index a8f8d7f..930bbcc 100644 --- a/src/java/org/apache/cassandra/config/DatabaseDescriptor.java +++ b/src/java/org/apache/cassandra/config/DatabaseDescriptor.java @@ -265,6 +265,13 @@ public class DatabaseDescriptor throw new ConfigurationException("memtable_heap_space_in_mb must be positive"); logger.info("Global memtable heap threshold is enabled at {}MB", conf.memtable_total_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"); @@ -1420,7 +1427,7 @@ public class DatabaseDescriptor { return memtablePool .getConstructor(long.class, float.class, Runnable.class) - .newInstance(conf.memtable_total_space_in_mb << 20, conf.memtable_cleanup_threshold, new ColumnFamilyStore.FlushLargestColumnFamily()); + .newInstance(((long) conf.memtable_total_space_in_mb) << 20, conf.memtable_cleanup_threshold, new ColumnFamilyStore.FlushLargestColumnFamily()); } catch (Exception e) {
