cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xe...@apache.org
Subject [2/6] git commit: make autoconfiguration happen only if key_cache_size_in_mb value was left blank in conf/cassandra.yaml (CASSANDRA-4087)
Date Tue, 27 Mar 2012 20:13:03 GMT
make autoconfiguration happen only if key_cache_size_in_mb value was left blank in conf/cassandra.yaml
(CASSANDRA-4087)


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/e12840e2
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/e12840e2
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/e12840e2

Branch: refs/heads/cassandra-1.1
Commit: e12840e2182dfd12cb70df9a5aca4111a3a13217
Parents: a59a5f5
Author: Pavel Yaskevich <xedin@apache.org>
Authored: Tue Mar 27 23:02:43 2012 +0300
Committer: Pavel Yaskevich <xedin@apache.org>
Committed: Tue Mar 27 23:10:04 2012 +0300

----------------------------------------------------------------------
 conf/cassandra.yaml                                |    4 ++--
 src/java/org/apache/cassandra/config/Config.java   |    2 +-
 .../cassandra/config/DatabaseDescriptor.java       |    6 +++---
 3 files changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/e12840e2/conf/cassandra.yaml
----------------------------------------------------------------------
diff --git a/conf/cassandra.yaml b/conf/cassandra.yaml
index 4010d74..866319c 100644
--- a/conf/cassandra.yaml
+++ b/conf/cassandra.yaml
@@ -77,8 +77,8 @@ commitlog_directory: /var/lib/cassandra/commitlog
 #
 # NOTE: if you reduce the size, you may not get you hottest keys loaded on startup.
 #
-# Default value is "auto" (min(5% of Heap (in MB), 100MB)). Set to 0 to disable key cache.
-key_cache_size_in_mb: auto
+# Default value is empty to make it "auto" (min(5% of Heap (in MB), 100MB)). Set to 0 to
disable key cache.
+key_cache_size_in_mb:
 
 # Duration in seconds after which Cassandra should
 # safe the keys cache. Caches are saved to saved_caches_directory as

http://git-wip-us.apache.org/repos/asf/cassandra/blob/e12840e2/src/java/org/apache/cassandra/config/Config.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/config/Config.java b/src/java/org/apache/cassandra/config/Config.java
index a9b9964..2bc34dc 100644
--- a/src/java/org/apache/cassandra/config/Config.java
+++ b/src/java/org/apache/cassandra/config/Config.java
@@ -128,7 +128,7 @@ public class Config
     public boolean trickle_fsync = false;
     public int trickle_fsync_interval_in_kb = 10240;
 
-    public String key_cache_size_in_mb = "auto";
+    public Integer key_cache_size_in_mb = null;
     public int key_cache_save_period = 14400;
     public int key_cache_keys_to_save = Integer.MAX_VALUE;
 

http://git-wip-us.apache.org/repos/asf/cassandra/blob/e12840e2/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 11543ff..8c5997f 100644
--- a/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
+++ b/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
@@ -418,9 +418,9 @@ public class DatabaseDescriptor
             try
             {
                 // if key_cache_size_in_mb option was set to "auto" then size of the cache
should be "min(5% of Heap (in MB), 100MB)
-                keyCacheSizeInMB = "auto".equalsIgnoreCase(conf.key_cache_size_in_mb)
+                keyCacheSizeInMB = (conf.key_cache_size_in_mb == null)
                                     ? Math.min((int) (Runtime.getRuntime().totalMemory()
* 0.05 / 1024 / 1024), 100)
-                                    : Integer.valueOf(conf.key_cache_size_in_mb);
+                                    : conf.key_cache_size_in_mb;
 
                 if (keyCacheSizeInMB < 0)
                     throw new NumberFormatException(); // to escape duplicating error message
@@ -428,7 +428,7 @@ public class DatabaseDescriptor
             catch (NumberFormatException e)
             {
                 throw new ConfigurationException("key_cache_size_in_mb option was set incorrectly
to '"
-                                                 + conf.key_cache_size_in_mb + "', supported
values are 'auto' and <integer> >= 0.");
+                                                 + conf.key_cache_size_in_mb + "', supported
values are <integer> >= 0.");
             }
 
             rowCacheProvider = FBUtilities.newCacheProvider(conf.row_cache_provider);


Mime
View raw message