cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r762380 - in /incubator/cassandra/trunk/src/org/apache/cassandra: db/TimeFilter.java io/SSTable.java io/SequenceFile.java
Date Mon, 06 Apr 2009 15:10:27 GMT
Author: jbellis
Date: Mon Apr  6 15:10:26 2009
New Revision: 762380

URL: http://svn.apache.org/viewvc?rev=762380&view=rev
Log:
emphasize that when getting a time-based slice only the CF name is used.  patch by jbellis;
reviewed by Jun Rau.  see #52

Modified:
    incubator/cassandra/trunk/src/org/apache/cassandra/db/TimeFilter.java
    incubator/cassandra/trunk/src/org/apache/cassandra/io/SSTable.java
    incubator/cassandra/trunk/src/org/apache/cassandra/io/SequenceFile.java

Modified: incubator/cassandra/trunk/src/org/apache/cassandra/db/TimeFilter.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/org/apache/cassandra/db/TimeFilter.java?rev=762380&r1=762379&r2=762380&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/org/apache/cassandra/db/TimeFilter.java (original)
+++ incubator/cassandra/trunk/src/org/apache/cassandra/db/TimeFilter.java Mon Apr  6 15:10:26
2009
@@ -144,8 +144,8 @@
 		return isDone_;
 	}
 
-	public DataInputBuffer next(String key, String cf, SSTable ssTable) throws IOException
+	public DataInputBuffer next(String key, String cfName, SSTable ssTable) throws IOException
     {
-    	return ssTable.next( key, cf, new IndexHelper.TimeRange( timeLimit_, Long.MAX_VALUE
) );
+    	return ssTable.next( key, cfName, new IndexHelper.TimeRange( timeLimit_, Long.MAX_VALUE
) );
     }
 }

Modified: incubator/cassandra/trunk/src/org/apache/cassandra/io/SSTable.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/org/apache/cassandra/io/SSTable.java?rev=762380&r1=762379&r2=762380&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/org/apache/cassandra/io/SSTable.java (original)
+++ incubator/cassandra/trunk/src/org/apache/cassandra/io/SSTable.java Mon Apr  6 15:10:26
2009
@@ -906,7 +906,7 @@
         return bufIn;
     }
     
-    public DataInputBuffer next(String key, String columnName, IndexHelper.TimeRange timeRange)
throws IOException
+    public DataInputBuffer next(String key, String cfName, IndexHelper.TimeRange timeRange)
throws IOException
     {
         DataInputBuffer bufIn = null;
         IFileReader dataReader = null;
@@ -920,7 +920,7 @@
              * we have the position we have to read from in order to get the
              * column family, get the column family and column(s) needed.
             */  
-            bufIn = getData(dataReader, key, columnName, timeRange, fileCoordinate);
+            bufIn = getData(dataReader, key, cfName, timeRange, fileCoordinate);
         }
         finally
         {
@@ -987,14 +987,14 @@
     /*
      * Get the data for the key from the position passed in. 
     */
-    private DataInputBuffer getData(IFileReader dataReader, String key, String column, IndexHelper.TimeRange
timeRange, Coordinate section) throws IOException
+    private DataInputBuffer getData(IFileReader dataReader, String key, String cfName, IndexHelper.TimeRange
timeRange, Coordinate section) throws IOException
     {
         DataOutputBuffer bufOut = new DataOutputBuffer();
         DataInputBuffer bufIn = new DataInputBuffer();
                 
         try
         {
-            dataReader.next(key, bufOut, column, timeRange, section);
+            dataReader.next(key, bufOut, cfName, timeRange, section);
             if ( bufOut.getLength() > 0 )
             {                              
                 bufIn.reset(bufOut.getData(), bufOut.getLength());            

Modified: incubator/cassandra/trunk/src/org/apache/cassandra/io/SequenceFile.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/org/apache/cassandra/io/SequenceFile.java?rev=762380&r1=762379&r2=762380&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/org/apache/cassandra/io/SequenceFile.java (original)
+++ incubator/cassandra/trunk/src/org/apache/cassandra/io/SequenceFile.java Mon Apr  6 15:10:26
2009
@@ -869,11 +869,9 @@
          * @return number of bytes that were read.
          * @throws IOException
          */
-        public long next(String key, DataOutputBuffer bufOut, String cf, IndexHelper.TimeRange
timeRange, Coordinate section) throws IOException
+        public long next(String key, DataOutputBuffer bufOut, String columnFamilyName, IndexHelper.TimeRange
timeRange, Coordinate section) throws IOException
         {
-            String[] values = RowMutation.getColumnAndColumnFamily(cf);
-            String columnFamilyName = values[0];
-            String columnName = (values.length == 1) ? null : values[1];
+            assert !columnFamilyName.contains(":");
 
             long bytesRead = -1L;
             if (isEOF())
@@ -903,57 +901,54 @@
                     /* write the key into buffer */
                     bufOut.writeUTF(keyInDisk);
 
-                    if (columnName == null)
-                    {
-                        int bytesSkipped = IndexHelper.skipBloomFilter(file_);
-                        /*
-                         * read the correct number of bytes for the column family and
-                         * write data into buffer. Substract from dataSize the bloom
-                         * filter size.
-                        */
-                        dataSize -= bytesSkipped;
-                        List<IndexHelper.ColumnIndexInfo> columnIndexList = new ArrayList<IndexHelper.ColumnIndexInfo>();
-                        /* Read the times indexes if present */
-                        int totalBytesRead = handleColumnTimeIndexes(columnFamilyName, columnIndexList);
-                        dataSize -= totalBytesRead;
-
-                        /* read the column family name */
-                        String cfName = file_.readUTF();
-                        dataSize -= (utfPrefix_ + cfName.length());
-
-                        /* read if this cf is marked for delete */
-                        long markedForDeleteAt = file_.readLong();
-                        dataSize -= 8;
-
-                        /* read the total number of columns */
-                        int totalNumCols = file_.readInt();
-                        dataSize -= 4;
-
-                        /* get the column range we have to read */
-                        IndexHelper.ColumnRange columnRange = IndexHelper.getColumnRangeFromTimeIndex(timeRange,
columnIndexList, dataSize, totalNumCols);
-
-                        Coordinate coordinate = columnRange.coordinate();
-                        /* seek to the correct offset to the data, and calculate the data
size */
-                        file_.skipBytes((int) coordinate.start_);
-                        dataSize = (int) (coordinate.end_ - coordinate.start_);
-
-                        /*
-                         * write the number of columns in the column family we are returning:
-                         *  dataSize that we are reading +
-                         *  length of column family name +
-                         *  one booleanfor deleted or not +
-                         *  one int for number of columns
-                        */
-                        bufOut.writeInt(dataSize + utfPrefix_ + cfName.length() + 4 + 1);
-                        /* write the column family name */
-                        bufOut.writeUTF(cfName);
-                        /* write if this cf is marked for delete */
-                        bufOut.writeLong(markedForDeleteAt);
-                        /* write number of columns */
-                        bufOut.writeInt(columnRange.count());
-                        /* now write the columns */
-                        bufOut.write(file_, dataSize);
-                    }
+                    int bytesSkipped = IndexHelper.skipBloomFilter(file_);
+                    /*
+                     * read the correct number of bytes for the column family and
+                     * write data into buffer. Substract from dataSize the bloom
+                     * filter size.
+                    */
+                    dataSize -= bytesSkipped;
+                    List<IndexHelper.ColumnIndexInfo> columnIndexList = new ArrayList<IndexHelper.ColumnIndexInfo>();
+                    /* Read the times indexes if present */
+                    int totalBytesRead = handleColumnTimeIndexes(columnFamilyName, columnIndexList);
+                    dataSize -= totalBytesRead;
+
+                    /* read the column family name */
+                    String cfName = file_.readUTF();
+                    dataSize -= (utfPrefix_ + cfName.length());
+
+                    /* read if this cf is marked for delete */
+                    long markedForDeleteAt = file_.readLong();
+                    dataSize -= 8;
+
+                    /* read the total number of columns */
+                    int totalNumCols = file_.readInt();
+                    dataSize -= 4;
+
+                    /* get the column range we have to read */
+                    IndexHelper.ColumnRange columnRange = IndexHelper.getColumnRangeFromTimeIndex(timeRange,
columnIndexList, dataSize, totalNumCols);
+
+                    Coordinate coordinate = columnRange.coordinate();
+                    /* seek to the correct offset to the data, and calculate the data size
*/
+                    file_.skipBytes((int) coordinate.start_);
+                    dataSize = (int) (coordinate.end_ - coordinate.start_);
+
+                    /*
+                     * write the number of columns in the column family we are returning:
+                     *  dataSize that we are reading +
+                     *  length of column family name +
+                     *  one booleanfor deleted or not +
+                     *  one int for number of columns
+                    */
+                    bufOut.writeInt(dataSize + utfPrefix_ + cfName.length() + 4 + 1);
+                    /* write the column family name */
+                    bufOut.writeUTF(cfName);
+                    /* write if this cf is marked for delete */
+                    bufOut.writeLong(markedForDeleteAt);
+                    /* write number of columns */
+                    bufOut.writeInt(columnRange.count());
+                    /* now write the columns */
+                    bufOut.write(file_, dataSize);
                 }
                 else
                 {



Mime
View raw message