cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xe...@apache.org
Subject [2/2] git commit: Respect 1.0 cache settings as much as possible when upgrading Patch by Pavel Yaskevich; reviewed by Yuki Morishita for CASSANDRA-4088
Date Fri, 30 Mar 2012 20:59:05 GMT
Respect 1.0 cache settings as much as possible when upgrading
Patch by Pavel Yaskevich; reviewed by Yuki Morishita for CASSANDRA-4088


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

Branch: refs/heads/cassandra-1.1
Commit: ef50e8f12a81986407351f5b7e3125dab2d4ffa1
Parents: e4e8766
Author: Pavel Yaskevich <xedin@apache.org>
Authored: Fri Mar 30 14:47:44 2012 +0300
Committer: Pavel Yaskevich <xedin@apache.org>
Committed: Fri Mar 30 23:54:46 2012 +0300

----------------------------------------------------------------------
 CHANGES.txt                                    |    1 +
 src/avro/internode.genavro                     |    2 +
 src/java/org/apache/cassandra/config/Avro.java |   20 +++++++++++++++++-
 3 files changed, 21 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/ef50e8f1/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 5f0db66..efb4ebe 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -4,6 +4,7 @@
  * fix KEYS index from skipping results (CASSANDRA-3996)
  * Remove sliced_buffer_size_in_kb dead option (CASSANDRA-4076)
  * make loadNewSStable preserve sstable version (CASSANDRA-4077)
+ * Respect 1.0 cache settings as much as possible when upgrading (CASSANDRA-4088)
 
 
 1.1-beta2

http://git-wip-us.apache.org/repos/asf/cassandra/blob/ef50e8f1/src/avro/internode.genavro
----------------------------------------------------------------------
diff --git a/src/avro/internode.genavro b/src/avro/internode.genavro
index d060d6e..d7ba60f 100644
--- a/src/avro/internode.genavro
+++ b/src/avro/internode.genavro
@@ -70,6 +70,8 @@ protocol InterNode {
         union { null, array<bytes> } column_aliases = null;
         union { null, bytes } value_alias = null;
         union { double, null } dclocal_read_repair_chance = 0.0;
+        union { double, null } row_cache_size;
+        union { double, null } key_cache_size;
     }
 
     @aliases(["org.apache.cassandra.config.avro.KsDef"])

http://git-wip-us.apache.org/repos/asf/cassandra/blob/ef50e8f1/src/java/org/apache/cassandra/config/Avro.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/config/Avro.java b/src/java/org/apache/cassandra/config/Avro.java
index 954a6aa..8e0de76 100644
--- a/src/java/org/apache/cassandra/config/Avro.java
+++ b/src/java/org/apache/cassandra/config/Avro.java
@@ -32,6 +32,8 @@ import org.apache.cassandra.locator.NetworkTopologyStrategy;
 import org.apache.cassandra.thrift.IndexType;
 import org.apache.cassandra.utils.ByteBufferUtil;
 
+import static org.apache.cassandra.config.CFMetaData.Caching;
+
 /**
  * methods to load schema definitions from old-style Avro serialization
  */
@@ -71,9 +73,23 @@ public class Avro
 
         int cfsz = ks.cf_defs.size();
         List<CFMetaData> cfMetaData = new ArrayList<CFMetaData>(cfsz);
-        Iterator<CfDef> cfiter = ks.cf_defs.iterator();
+
         for (CfDef cf_def : ks.cf_defs)
-            cfMetaData.add(cfFromAvro(cfiter.next()));
+        {
+            double keysCached = cf_def.key_cache_size == null ? -1 : cf_def.key_cache_size;
+            double rowsCached = cf_def.row_cache_size == null ? -1 : cf_def.row_cache_size;
+
+            if (keysCached > 0 && rowsCached > 0)
+                cf_def.caching = Caching.ALL.name();
+            else if (keysCached <= 0 && rowsCached <= 0)
+                cf_def.caching = Caching.NONE.name();
+            else if (keysCached > 0 && rowsCached <= 0)
+                cf_def.caching = Caching.KEYS_ONLY.name();
+            else
+                cf_def.caching = Caching.ROWS_ONLY.name();
+
+            cfMetaData.add(cfFromAvro(cf_def));
+        }
 
         return new KSMetaData(ks.name.toString(), repStratClass, strategyOptions, ks.durable_writes,
cfMetaData);
     }


Mime
View raw message