mirror of https://github.com/apache/cassandra
emphasize that when getting a time-based slice only the CF name is used. patch by jbellis; reviewed by Jun Rau. see #52
git-svn-id: https://svn.apache.org/repos/asf/incubator/cassandra/trunk@762380 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
27013dad79
commit
49d75c4303
|
|
@ -144,8 +144,8 @@ class TimeFilter implements IFilter
|
|||
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 ) );
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -906,7 +906,7 @@ public class SSTable
|
|||
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 @@ public class SSTable
|
|||
* 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 @@ public class SSTable
|
|||
/*
|
||||
* 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());
|
||||
|
|
|
|||
|
|
@ -869,11 +869,9 @@ public class SequenceFile
|
|||
* @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 @@ public class SequenceFile
|
|||
/* 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;
|
||||
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 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 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;
|
||||
/* 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);
|
||||
/* 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_);
|
||||
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);
|
||||
}
|
||||
/*
|
||||
* 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
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue