cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r925058 - /cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/io/SSTableReader.java
Date Fri, 19 Mar 2010 00:48:04 GMT
Author: jbellis
Date: Fri Mar 19 00:48:03 2010
New Revision: 925058

URL: http://svn.apache.org/viewvc?rev=925058&view=rev
Log:
add back "unnecessary" != null checks w/ comment.  patch by jbellis

Modified:
    cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/io/SSTableReader.java

Modified: cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/io/SSTableReader.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/io/SSTableReader.java?rev=925058&r1=925057&r2=925058&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/io/SSTableReader.java (original)
+++ cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/io/SSTableReader.java Fri
Mar 19 00:48:03 2010
@@ -188,6 +188,8 @@ public class SSTableReader extends SSTab
     {
         phantomReference = new SSTableDeletingReference(tracker, this, finalizerQueue);
         finalizers.add(phantomReference);
+        // TODO keyCache should never be null in live Cassandra, but only setting it here
+        // means it can be during tests, so we have to do otherwise-unnecessary != null checks
         keyCache = tracker.getKeyCache();
     }
 
@@ -321,7 +323,7 @@ public class SSTableReader extends SSTab
 
         // next, the key cache
         Pair<String, DecoratedKey> unifiedKey = new Pair<String, DecoratedKey>(path,
decoratedKey);
-        if (keyCache.getCapacity() > 0)
+        if (keyCache != null && keyCache.getCapacity() > 0)
         {
             PositionSize cachedPosition = keyCache.get(unifiedKey);
             if (cachedPosition != null)
@@ -387,7 +389,7 @@ public class SSTableReader extends SSTab
                     {
                         info = new PositionSize(position, length() - position);
                     }
-                    if (keyCache.getCapacity() > 0)
+                    if (keyCache != null && keyCache.getCapacity() > 0)
                         keyCache.put(unifiedKey, info);
                     return info;
                 }



Mime
View raw message