You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by jb...@apache.org on 2014/07/15 23:21:08 UTC
[3/6] git commit: reorder to avoid NPE
reorder to avoid NPE
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/fad5ad5a
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/fad5ad5a
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/fad5ad5a
Branch: refs/heads/trunk
Commit: fad5ad5a6af5a9ed2954a6395149f0ca95d34603
Parents: 233bd3c
Author: Jonathan Ellis <jb...@apache.org>
Authored: Tue Jul 15 16:19:25 2014 -0500
Committer: Jonathan Ellis <jb...@apache.org>
Committed: Tue Jul 15 16:19:25 2014 -0500
----------------------------------------------------------------------
.../cassandra/config/DatabaseDescriptor.java | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/fad5ad5a/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 d56bfe3..d89967d 100644
--- a/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
+++ b/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
@@ -288,15 +288,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 or hostname to bind services to */
if (conf.listen_address != null)
@@ -486,9 +477,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)));