Author: goffinet
Date: Tue May 31 02:08:39 2011
New Revision: 1129462

URL: http://svn.apache.org/viewvc?rev=1129462&view=rev
Log:
Fixed rows being cached if they do not exist.
patch by goffinet; reviewed by stuhood for CASSANDRA-2723

Modified:
    
cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/db/ColumnFamilyStore.java

Modified: 
cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
URL: 
http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/db/ColumnFamilyStore.java?rev=1129462&r1=1129461&r2=1129462&view=diff
==============================================================================
--- 
cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
 (original)
+++ 
cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
 Tue May 31 02:08:39 2011
@@ -1186,7 +1186,10 @@ public class ColumnFamilyStore implement
             if (rowCache.getCapacity() == 0)
             {
                 ColumnFamily cf = getTopLevelColumns(filter, gcBefore);
-                         
+
+                if (cf == null)
+                    return null;
+
                 // TODO this is necessary because when we collate supercolumns 
together, we don't check
                 // their subcolumns for relevance, so we need to do a second 
prune post facto here.
                 return cf.isSuper() ? removeDeleted(cf, gcBefore) : 
removeDeletedCF(cf, gcBefore);
@@ -1297,14 +1300,17 @@ public class ColumnFamilyStore implement
             recentSSTablesPerRead.add(sstablesToIterate);
             sstablesPerRead.add(sstablesToIterate);
 
+            // we need to distinguish between "there is no data at all for 
this row" (BF will let us rebuild that efficiently)
+            // and "there used to be data, but it's gone now" (we should cache 
the empty CF so we don't need to rebuild that slower)
+            if (iterators.size() == 0)
+                return null;
+
             Comparator<IColumn> comparator = 
filter.filter.getColumnComparator(getComparator());
             Iterator collated = IteratorUtils.collatedIterator(comparator, 
iterators);
 
             filter.collectCollatedColumns(returnCF, collated, gcBefore);
 
             // Caller is responsible for final removeDeletedCF.  This is 
important for cacheRow to work correctly:
-            // we need to distinguish between "there is no data at all for 
this row" (BF will let us rebuild that efficiently)
-            // and "there used to be data, but it's gone now" (we should cache 
the empty CF so we don't need to rebuild that slower)
             return returnCF;
         }
         finally


Reply via email to