cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r898893 - in /incubator/cassandra/trunk: src/java/org/apache/cassandra/config/DatabaseDescriptor.java src/java/org/apache/cassandra/db/ColumnFamilyStore.java test/conf/storage-conf.xml
Date Wed, 13 Jan 2010 19:13:40 GMT
Author: jbellis
Date: Wed Jan 13 19:13:39 2010
New Revision: 898893

URL: http://svn.apache.org/viewvc?rev=898893&view=rev
Log:
fix enabling/disabling row cache.
patch by jbellis; reviewed by goffinet for CASSANDRA-689

Modified:
    incubator/cassandra/trunk/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
    incubator/cassandra/trunk/test/conf/storage-conf.xml

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/config/DatabaseDescriptor.java?rev=898893&r1=898892&r2=898893&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
(original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
Wed Jan 13 19:13:39 2010
@@ -965,7 +965,7 @@
     public static double getRowsCachedFraction(String tableName, String columnFamilyName)
     {
         Double v = tableRowsCachedFractions_.get(Pair.create(tableName, columnFamilyName));
-        return v == null ? 0.01 : v;
+        return v == null ? 0 : v;
     }
 
     private static class ConfigurationException extends Exception

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilyStore.java?rev=898893&r1=898892&r2=898893&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilyStore.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilyStore.java Wed
Jan 13 19:13:39 2010
@@ -186,11 +186,13 @@
         ssTables_ = new SSTableTracker(sstables);
 
         double v = DatabaseDescriptor.getRowsCachedFraction(table, columnFamilyName);
-        int cacheSize = (int)(v * SSTableReader.estimatedKeys(columnFamilyName));
-        if (logger_.isDebugEnabled())
-            logger_.debug("cache size for " + columnFamilyName + " is " + cacheSize);
-        if (cacheSize > 0)
+        if (v > 0)
+        {
+            int cacheSize = Math.max(1, (int)(v * SSTableReader.estimatedKeys(columnFamilyName)));
+            if (logger_.isDebugEnabled())
+                logger_.debug("enabling row cache for " + columnFamilyName + " with size
" + cacheSize);
             rowCache = new InstrumentedCache<String, ColumnFamily>(table, columnFamilyName
+ "RowCache", cacheSize);
+        }
     }
 
     public static ColumnFamilyStore createColumnFamilyStore(String table, String columnFamily)
throws IOException
@@ -803,7 +805,11 @@
             else
             {
                 cf = getCachedRow(filter);
+                if (cf == null)
+                    return null;
                 sc = (SuperColumn)cf.getColumn(filter.path.superColumnName);
+                if (sc == null)
+                    return null;
             }
             
             SuperColumn scFiltered = filter.filterSuperColumn(sc, gcBefore);

Modified: incubator/cassandra/trunk/test/conf/storage-conf.xml
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/test/conf/storage-conf.xml?rev=898893&r1=898892&r2=898893&view=diff
==============================================================================
--- incubator/cassandra/trunk/test/conf/storage-conf.xml (original)
+++ incubator/cassandra/trunk/test/conf/storage-conf.xml Wed Jan 13 19:13:39 2010
@@ -48,7 +48,7 @@
        <ColumnFamily Name="Standard2"/>
        <ColumnFamily CompareWith="LongType" Name="StandardLong1"/>
        <ColumnFamily CompareWith="LongType" Name="StandardLong2"/>
-       <ColumnFamily ColumnType="Super" CompareSubcolumnsWith="LongType" Name="Super1"/>
+       <ColumnFamily ColumnType="Super" CompareSubcolumnsWith="LongType" Name="Super1"
RowsCachedFraction="0.1" KeysCachedFraction="0"/>
        <ColumnFamily ColumnType="Super" CompareSubcolumnsWith="LongType" Name="Super2"/>
        <ColumnFamily ColumnType="Super" CompareSubcolumnsWith="LongType" Name="Super3"/>
        <ColumnFamily ColumnType="Super" CompareSubcolumnsWith="UTF8Type" Name="Super4"/>



Mime
View raw message