cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r925055 - in /cassandra/branches/cassandra-0.6: ./ interface/thrift/ src/java/org/apache/cassandra/io/SSTableReader.java src/java/org/apache/cassandra/io/SSTableWriter.java src/java/org/apache/cassandra/io/util/MappedFileDataInput.java
Date Fri, 19 Mar 2010 00:38:07 GMT
Author: jbellis
Date: Fri Mar 19 00:38:07 2010
New Revision: 925055

URL: http://svn.apache.org/viewvc?rev=925055&view=rev
Log:
SSTR cleanup.  patch by jbellis

Modified:
    cassandra/branches/cassandra-0.6/   (props changed)
    cassandra/branches/cassandra-0.6/interface/thrift/   (props changed)
    cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/io/SSTableReader.java
    cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/io/SSTableWriter.java
    cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/io/util/MappedFileDataInput.java

Propchange: cassandra/branches/cassandra-0.6/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Fri Mar 19 00:38:07 2010
@@ -4,3 +4,5 @@
 temp-testng-customsuite.xml
 build
 build.properties
+.idea
+out

Propchange: cassandra/branches/cassandra-0.6/interface/thrift/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Mar 19 00:38:07 2010
@@ -0,0 +1 @@
+*.iml

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=925055&r1=925054&r2=925055&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:38:07 2010
@@ -112,6 +112,7 @@ public class SSTableReader extends SSTab
         return open(dataFileName, StorageService.getPartitioner());
     }
 
+    /** public, but only for tests */
     public static SSTableReader open(String dataFileName, IPartitioner partitioner) throws
IOException
     {
         assert partitioner != null;
@@ -320,7 +321,7 @@ public class SSTableReader extends SSTab
 
         // next, the key cache
         Pair<String, DecoratedKey> unifiedKey = new Pair<String, DecoratedKey>(path,
decoratedKey);
-        if (keyCache != null && keyCache.getCapacity() > 0)
+        if (keyCache.getCapacity() > 0)
         {
             PositionSize cachedPosition = keyCache.get(unifiedKey);
             if (cachedPosition != null)
@@ -386,7 +387,7 @@ public class SSTableReader extends SSTab
                     {
                         info = new PositionSize(position, length() - position);
                     }
-                    if (keyCache != null && keyCache.getCapacity() > 0)
+                    if (keyCache.getCapacity() > 0)
                         keyCache.put(unifiedKey, info);
                     return info;
                 }

Modified: cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/io/SSTableWriter.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/io/SSTableWriter.java?rev=925055&r1=925054&r2=925055&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/io/SSTableWriter.java (original)
+++ cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/io/SSTableWriter.java Fri
Mar 19 00:38:07 2010
@@ -86,8 +86,8 @@ public class SSTableWriter extends SSTab
         if (logger.isTraceEnabled())
             logger.trace("wrote index of " + decoratedKey + " at " + indexPosition);
 
-        boolean spannedEntry = SSTableReader.bufferIndex(indexPosition) != SSTableReader.bufferIndex(indexFile.getFilePointer());
-        if (keysWritten++ % INDEX_INTERVAL == 0 || spannedEntry)
+        boolean spannedIndexEntry = SSTableReader.bufferIndex(indexPosition) != SSTableReader.bufferIndex(indexFile.getFilePointer());
+        if (keysWritten++ % INDEX_INTERVAL == 0 || spannedIndexEntry)
         {
             if (indexPositions == null)
             {
@@ -96,7 +96,7 @@ public class SSTableWriter extends SSTab
             KeyPosition info = new KeyPosition(decoratedKey, indexPosition);
             indexPositions.add(info);
 
-            if (spannedEntry)
+            if (spannedIndexEntry)
             {
                 if (spannedIndexDataPositions == null)
                 {
@@ -180,8 +180,7 @@ public class SSTableWriter extends SSTab
         SSTableWriter.rename(indexFilename(dataFileName));
         SSTableWriter.rename(filterFilename(dataFileName));
         dataFileName = SSTableWriter.rename(dataFileName);
-        return SSTableReader.open(dataFileName,
-                                  StorageService.getPartitioner());
+        return SSTableReader.open(dataFileName);
     }
 
 }

Modified: cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/io/util/MappedFileDataInput.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/io/util/MappedFileDataInput.java?rev=925055&r1=925054&r2=925055&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/io/util/MappedFileDataInput.java
(original)
+++ cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/io/util/MappedFileDataInput.java
Fri Mar 19 00:38:07 2010
@@ -98,7 +98,8 @@ public class MappedFileDataInput extends
 
     public int skipBytes(int n) throws IOException
     {
-        if (n <= 0)
+        assert n >= 0 : "skipping negative bytes is illegal: " + n;
+        if (n == 0)
             return 0;
         int oldPosition = position;
         assert ((long)oldPosition) + n <= Integer.MAX_VALUE;



Mime
View raw message