cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xe...@apache.org
Subject svn commit: r1169969 - in /cassandra/branches/cassandra-1.0.0: ./ interface/ interface/thrift/gen-java/org/apache/cassandra/thrift/ src/java/org/apache/cassandra/cache/ src/java/org/apache/cassandra/config/ src/java/org/apache/cassandra/cql/ src/resour...
Date Mon, 12 Sep 2011 22:51:49 GMT
Author: xedin
Date: Mon Sep 12 22:51:48 2011
New Revision: 1169969

URL: http://svn.apache.org/viewvc?rev=1169969&view=rev
Log:
Make SerializingCacheProvider the default if JNA is available
patch by Pavel Yaskevich; reviewed by Jonathan Ellis for CASSANDRA-3183

Modified:
    cassandra/branches/cassandra-1.0.0/CHANGES.txt
    cassandra/branches/cassandra-1.0.0/interface/cassandra.thrift
    cassandra/branches/cassandra-1.0.0/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java
    cassandra/branches/cassandra-1.0.0/interface/thrift/gen-java/org/apache/cassandra/thrift/CfDef.java
    cassandra/branches/cassandra-1.0.0/interface/thrift/gen-java/org/apache/cassandra/thrift/Constants.java
    cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/cache/SerializingCacheProvider.java
    cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/config/CFMetaData.java
    cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/cql/CreateColumnFamilyStatement.java
    cassandra/branches/cassandra-1.0.0/src/resources/org/apache/cassandra/cli/CliHelp.yaml

Modified: cassandra/branches/cassandra-1.0.0/CHANGES.txt
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-1.0.0/CHANGES.txt?rev=1169969&r1=1169968&r2=1169969&view=diff
==============================================================================
--- cassandra/branches/cassandra-1.0.0/CHANGES.txt (original)
+++ cassandra/branches/cassandra-1.0.0/CHANGES.txt Mon Sep 12 22:51:48 2011
@@ -70,6 +70,7 @@
  * Arena-based allocation for memtables (CASSANDRA-2252, 3162, 3163, 3168)
  * Default RR chance to 0.1 (CASSANDRA-3169)
  * Add RowLevel support to secondary index API (CASSANDRA-3147)
+ * Make SerializingCacheProvider the default if JNA is available (CASSANDRA-3183)
 
 0.8.6
  * avoid trying to watch cassandra-topology.properties when loaded from jar

Modified: cassandra/branches/cassandra-1.0.0/interface/cassandra.thrift
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-1.0.0/interface/cassandra.thrift?rev=1169969&r1=1169968&r2=1169969&view=diff
==============================================================================
--- cassandra/branches/cassandra-1.0.0/interface/cassandra.thrift (original)
+++ cassandra/branches/cassandra-1.0.0/interface/cassandra.thrift Mon Sep 12 22:51:48 2011
@@ -46,7 +46,7 @@ namespace rb CassandraThrift
 #           for every edit that doesn't result in a change to major/minor.
 #
 # See the Semantic Versioning Specification (SemVer) http://semver.org.
-const string VERSION = "19.14.0"
+const string VERSION = "19.15.0"
 
 
 #
@@ -392,7 +392,7 @@ struct CfDef {
     24: optional bool replicate_on_write,
     25: optional double merge_shards_chance,
     26: optional string key_validation_class,
-    27: optional string row_cache_provider="org.apache.cassandra.cache.ConcurrentLinkedHashCacheProvider",
+    27: optional string row_cache_provider,
     28: optional binary key_alias,
     29: optional string compaction_strategy,
     30: optional map<string,string> compaction_strategy_options,

Modified: cassandra/branches/cassandra-1.0.0/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-1.0.0/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java?rev=1169969&r1=1169968&r2=1169969&view=diff
==============================================================================
--- cassandra/branches/cassandra-1.0.0/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java
(original)
+++ cassandra/branches/cassandra-1.0.0/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java
Mon Sep 12 22:51:48 2011
@@ -9086,6 +9086,8 @@ public class Cassandra {
 
     private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException
{
       try {
+        // it doesn't seem like you should have to do this, but java serialization is wacky,
and doesn't call the default constructor.
+        __isset_bit_vector = new BitSet(1);
         read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
       } catch (org.apache.thrift.TException te) {
         throw new java.io.IOException(te);

Modified: cassandra/branches/cassandra-1.0.0/interface/thrift/gen-java/org/apache/cassandra/thrift/CfDef.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-1.0.0/interface/thrift/gen-java/org/apache/cassandra/thrift/CfDef.java?rev=1169969&r1=1169968&r2=1169969&view=diff
==============================================================================
--- cassandra/branches/cassandra-1.0.0/interface/thrift/gen-java/org/apache/cassandra/thrift/CfDef.java
(original)
+++ cassandra/branches/cassandra-1.0.0/interface/thrift/gen-java/org/apache/cassandra/thrift/CfDef.java
Mon Sep 12 22:51:48 2011
@@ -322,8 +322,6 @@ public class CfDef implements org.apache
 
     this.read_repair_chance = 1;
 
-    this.row_cache_provider = "org.apache.cassandra.cache.ConcurrentLinkedHashCacheProvider";
-
   }
 
   public CfDef(
@@ -465,8 +463,7 @@ public class CfDef implements org.apache
     setMerge_shards_chanceIsSet(false);
     this.merge_shards_chance = 0.0;
     this.key_validation_class = null;
-    this.row_cache_provider = "org.apache.cassandra.cache.ConcurrentLinkedHashCacheProvider";
-
+    this.row_cache_provider = null;
     this.key_alias = null;
     this.compaction_strategy = null;
     this.compaction_strategy_options = null;

Modified: cassandra/branches/cassandra-1.0.0/interface/thrift/gen-java/org/apache/cassandra/thrift/Constants.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-1.0.0/interface/thrift/gen-java/org/apache/cassandra/thrift/Constants.java?rev=1169969&r1=1169968&r2=1169969&view=diff
==============================================================================
--- cassandra/branches/cassandra-1.0.0/interface/thrift/gen-java/org/apache/cassandra/thrift/Constants.java
(original)
+++ cassandra/branches/cassandra-1.0.0/interface/thrift/gen-java/org/apache/cassandra/thrift/Constants.java
Mon Sep 12 22:51:48 2011
@@ -44,6 +44,6 @@ import org.slf4j.LoggerFactory;
 
 public class Constants {
 
-  public static final String VERSION = "19.14.0";
+  public static final String VERSION = "19.15.0";
 
 }

Modified: cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/cache/SerializingCacheProvider.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/cache/SerializingCacheProvider.java?rev=1169969&r1=1169968&r2=1169969&view=diff
==============================================================================
--- cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/cache/SerializingCacheProvider.java
(original)
+++ cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/cache/SerializingCacheProvider.java
Mon Sep 12 22:51:48 2011
@@ -20,7 +20,6 @@ package org.apache.cassandra.cache;
  * 
  */
 
-
 import org.apache.cassandra.config.ConfigurationException;
 import org.apache.cassandra.db.ColumnFamily;
 import org.apache.cassandra.db.DecoratedKey;
@@ -37,7 +36,7 @@ public class SerializingCacheProvider im
         }
         catch (NoClassDefFoundError e)
         {
-            throw new ConfigurationException("Cannot intialize SerializationCache without
JNA in the class path");
+            throw new ConfigurationException("Cannot initialize SerializationCache without
JNA in the class path");
         }
     }
 

Modified: cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/config/CFMetaData.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/config/CFMetaData.java?rev=1169969&r1=1169968&r2=1169969&view=diff
==============================================================================
--- cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/config/CFMetaData.java
(original)
+++ cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/config/CFMetaData.java
Mon Sep 12 22:51:48 2011
@@ -37,6 +37,9 @@ import org.apache.cassandra.db.migration
 import org.apache.cassandra.io.IColumnSerializer;
 import org.apache.cassandra.io.compress.CompressionParameters;
 import org.apache.cassandra.thrift.InvalidRequestException;
+import org.apache.cassandra.cache.ConcurrentLinkedHashCacheProvider;
+import org.apache.cassandra.cache.SerializingCacheProvider;
+import org.apache.cassandra.utils.CLibrary;
 import org.apache.cassandra.utils.ByteBufferUtil;
 import org.apache.cassandra.utils.FBUtilities;
 
@@ -64,7 +67,7 @@ public final class CFMetaData
     public final static int DEFAULT_MIN_COMPACTION_THRESHOLD = 4;
     public final static int DEFAULT_MAX_COMPACTION_THRESHOLD = 32;
     public final static double DEFAULT_MERGE_SHARDS_CHANCE = 0.1;
-    public final static String DEFAULT_ROW_CACHE_PROVIDER = "org.apache.cassandra.cache.ConcurrentLinkedHashCacheProvider";
+    public final static IRowCacheProvider DEFAULT_ROW_CACHE_PROVIDER = initDefaultRowCacheProvider();
     public final static String DEFAULT_COMPACTION_STRATEGY_CLASS = "SizeTieredCompactionStrategy";
     public final static ByteBuffer DEFAULT_KEY_NAME = ByteBufferUtil.bytes("KEY");
 
@@ -75,6 +78,18 @@ public final class CFMetaData
     public static final CFMetaData IndexCf = newSystemMetadata(SystemTable.INDEX_CF, 5, "indexes
that have been completed", UTF8Type.instance, null);
     public static final CFMetaData NodeIdCf = newSystemMetadata(SystemTable.NODE_ID_CF, 6,
"nodeId and their metadata", TimeUUIDType.instance, null);
 
+    private static IRowCacheProvider initDefaultRowCacheProvider()
+    {
+        try
+        {
+            return new SerializingCacheProvider();
+        }
+        catch (ConfigurationException e)
+        {
+            return new ConcurrentLinkedHashCacheProvider();
+        }
+    }
+
     //REQUIRED
     public final Integer cfId;                        // internal id, never exposed to user
     public final String ksName;                       // name of keyspace
@@ -171,14 +186,7 @@ public final class CFMetaData
         minCompactionThreshold       = DEFAULT_MIN_COMPACTION_THRESHOLD;
         maxCompactionThreshold       = DEFAULT_MAX_COMPACTION_THRESHOLD;
         mergeShardsChance            = DEFAULT_MERGE_SHARDS_CHANCE;
-        try
-        {
-            rowCacheProvider             = FBUtilities.newCacheProvider(DEFAULT_ROW_CACHE_PROVIDER);
-        }
-        catch (ConfigurationException e)
-        {
-            throw new AssertionError(e); // the default provider should not error out
-        }
+        rowCacheProvider             = DEFAULT_ROW_CACHE_PROVIDER;
 
         // Defaults strange or simple enough to not need a DEFAULT_T for
         defaultValidator = BytesType.instance;
@@ -368,7 +376,10 @@ public final class CFMetaData
             }
             catch (ConfigurationException e)
             {
-                throw new RuntimeException(e);
+                // default was already set upon newCFMD init
+                logger.warn("Unable to instantiate cache provider {}; using default {} instead",
+                            cf.row_cache_provider,
+                            DEFAULT_ROW_CACHE_PROVIDER);
             }
         }
         if (cf.key_alias != null) { newCFMD.keyAlias(cf.key_alias); }
@@ -609,8 +620,6 @@ public final class CFMetaData
             cf_def.setRow_cache_keys_to_save(CFMetaData.DEFAULT_ROW_CACHE_KEYS_TO_SAVE);
         if (!cf_def.isSetMerge_shards_chance())
             cf_def.setMerge_shards_chance(CFMetaData.DEFAULT_MERGE_SHARDS_CHANCE);
-        if (!cf_def.isSetRow_cache_provider())
-            cf_def.setRow_cache_provider(CFMetaData.DEFAULT_ROW_CACHE_PROVIDER);
         if (null == cf_def.compaction_strategy)
             cf_def.compaction_strategy = DEFAULT_COMPACTION_STRATEGY_CLASS;
         if (null == cf_def.compaction_strategy_options)
@@ -836,6 +845,7 @@ public final class CFMetaData
         def.setRow_cache_save_period_in_seconds(rowCacheSavePeriodInSeconds);
         def.setKey_cache_save_period_in_seconds(keyCacheSavePeriodInSeconds);
         def.setRow_cache_keys_to_save(rowCacheKeysToSave);
+        def.setRow_cache_provider(rowCacheProvider.getClass().getName());
         def.setMerge_shards_chance(mergeShardsChance);
         def.setKey_alias(getKeyName());
         List<org.apache.cassandra.thrift.ColumnDef> column_meta = new ArrayList<org.apache.cassandra.thrift.ColumnDef>(column_metadata.size());
@@ -962,6 +972,7 @@ public final class CFMetaData
             .append("rowCacheSavePeriodInSeconds", rowCacheSavePeriodInSeconds)
             .append("keyCacheSavePeriodInSeconds", keyCacheSavePeriodInSeconds)
             .append("rowCacheKeysToSave", rowCacheKeysToSave)
+            .append("rowCacheProvider", rowCacheProvider)
             .append("mergeShardsChance", mergeShardsChance)
             .append("keyAlias", keyAlias)
             .append("column_metadata", column_metadata)

Modified: cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/cql/CreateColumnFamilyStatement.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/cql/CreateColumnFamilyStatement.java?rev=1169969&r1=1169968&r2=1169969&view=diff
==============================================================================
--- cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/cql/CreateColumnFamilyStatement.java
(original)
+++ cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/cql/CreateColumnFamilyStatement.java
Mon Sep 12 22:51:48 2011
@@ -304,7 +304,7 @@ public class CreateColumnFamilyStatement
                    .mergeShardsChance(0.0)
                    .columnMetadata(getColumns(comparator))
                    .keyValidator(TypeParser.parse(comparators.get(getKeyType())))
-                   .rowCacheProvider(FBUtilities.newCacheProvider(getPropertyString(KW_ROW_CACHE_PROVIDER,
CFMetaData.DEFAULT_ROW_CACHE_PROVIDER)))
+                   .rowCacheProvider(FBUtilities.newCacheProvider(getPropertyString(KW_ROW_CACHE_PROVIDER,
CFMetaData.DEFAULT_ROW_CACHE_PROVIDER.getClass().getName())))
                    .keyAlias(keyAlias);
         }
         catch (ConfigurationException e)

Modified: cassandra/branches/cassandra-1.0.0/src/resources/org/apache/cassandra/cli/CliHelp.yaml
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-1.0.0/src/resources/org/apache/cassandra/cli/CliHelp.yaml?rev=1169969&r1=1169968&r2=1169969&view=diff
==============================================================================
--- cassandra/branches/cassandra-1.0.0/src/resources/org/apache/cassandra/cli/CliHelp.yaml
(original)
+++ cassandra/branches/cassandra-1.0.0/src/resources/org/apache/cassandra/cli/CliHelp.yaml
Mon Sep 12 22:51:48 2011
@@ -555,14 +555,13 @@ commands:
         It is also valid to specify the fully-qualified class name to a class
         that implements org.apache.cassandra.cache.IRowCacheProvider.
 
-        row_cache_provider defaults to ConcurrentLinkedHashCacheProvider, 
-        but if you have JNA installed you should usually use
-        SerializingCacheProvider, which serialises the contents of the
-        row and stores it in native memory, i.e., off the JVM
-        Heap. Serialized rows take significantly less memory than
-        "live" rows in the JVM, so you can cache more rows in a given
-        memory footprint.  And storing the cache off-heap means you
-        can use smaller heap sizes, reducing the impact of GC pauses.
+        row_cache_provider defaults to SerializingCacheProvider if you have JNA
+        enabled, otherwise ConcurrentLinkedHashCacheProvider.
+        SerializingCacheProvider serialises the contents of the row and stores
+        it in native memory, i.e., off the JVM Heap. Serialized rows take
+        significantly less memory than "live" rows in the JVM, so you can cache
+        more rows in a given memory footprint.  And storing the cache off-heap
+        means you can use smaller heap sizes, reducing the impact of GC pauses.
 
         - compression: Use compression for SSTable data files.
 



Mime
View raw message