cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r955831 - in /cassandra/trunk/src/java/org/apache/cassandra/io/sstable: SSTable.java SSTableReader.java
Date Fri, 18 Jun 2010 04:17:31 GMT
Author: jbellis
Date: Fri Jun 18 04:17:31 2010
New Revision: 955831

URL: http://svn.apache.org/viewvc?rev=955831&view=rev
Log:
move version checks into Descriptor.  patch by jbellis

Modified:
    cassandra/trunk/src/java/org/apache/cassandra/io/sstable/SSTable.java
    cassandra/trunk/src/java/org/apache/cassandra/io/sstable/SSTableReader.java

Modified: cassandra/trunk/src/java/org/apache/cassandra/io/sstable/SSTable.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/io/sstable/SSTable.java?rev=955831&r1=955830&r2=955831&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/io/sstable/SSTable.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/io/sstable/SSTable.java Fri Jun 18 04:17:31
2010
@@ -322,14 +322,6 @@ public abstract class SSTable
             return true;
         }
 
-        /**
-         * @return Compares the version for this descriptor to the given version.
-         */
-        public int versionCompareTo(String ver)
-        {
-            return version.compareTo(ver);
-        }
-
         @Override
         public String toString()
         {
@@ -352,5 +344,15 @@ public abstract class SSTable
         {
             return hashCode;
         }
+
+        public boolean hasStringsInBloomFilter()
+        {
+            return version.compareTo("c") < 0;
+        }
+
+        public boolean hasIntRowSize()
+        {
+            return version.compareTo("d") < 0;
+        }
     }
 }

Modified: cassandra/trunk/src/java/org/apache/cassandra/io/sstable/SSTableReader.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/io/sstable/SSTableReader.java?rev=955831&r1=955830&r2=955831&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/io/sstable/SSTableReader.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/io/sstable/SSTableReader.java Fri Jun 18
04:17:31 2010
@@ -23,8 +23,6 @@ import java.io.*;
 import java.util.*;
 import java.lang.ref.ReferenceQueue;
 import java.lang.ref.Reference;
-import java.nio.channels.FileChannel;
-import java.nio.MappedByteBuffer;
 
 import com.google.common.base.Function;
 import com.google.common.collect.Collections2;
@@ -177,8 +175,10 @@ public class SSTableReader extends SSTab
         SSTableReader sstable = new SSTableReader(desc, partitioner, null, null, null, null,
System.currentTimeMillis());
 
         // versions before 'c' encoded keys as utf-16 before hashing to the filter
-        if (desc.versionCompareTo("c") < 0)
+        if (desc.hasStringsInBloomFilter())
+        {
             sstable.load(true);
+        }
         else
         {
             sstable.load(false);
@@ -549,7 +549,7 @@ public class SSTableReader extends SSTab
 
     public static long readRowSize(DataInput in, Descriptor d) throws IOException
     {
-        if (d.versionCompareTo("d") < 0)
+        if (d.hasIntRowSize())
             return in.readInt();
         return in.readLong();
     }



Mime
View raw message