merge from 0.4

git-svn-id: https://svn.apache.org/repos/asf/incubator/cassandra/trunk@833785 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jonathan Ellis 2009-11-08 00:44:20 +00:00
parent 5d447035ba
commit 3d6d023e68
3 changed files with 31 additions and 17 deletions

View File

@ -32,7 +32,7 @@
per-CF FlushPeriodInMinutes setting (CASSANDRA-463)
* Datacenter quorum consistency levels (CASSANDRA-492)
* optimizations to slice reading (CASSANDRA-350)
0.4.2
* Add validation disallowing null keys (CASSANDRA-486)

View File

@ -37,7 +37,7 @@
<property name="test.name" value="*Test"/>
<property name="test.unit.src" value="${test.dir}/unit"/>
<property name="dist.dir" value="${build.dir}/dist"/>
<property name="version" value="0.4.1"/>
<property name="version" value="0.4.2"/>
<property name="final.name" value="${ant.project.name}-${version}"/>
<!-- http://cobertura.sourceforge.net/ -->

View File

@ -189,30 +189,44 @@ public class SSTableReader extends SSTable implements Comparable<SSTableReader>
private void loadBloomFilter() throws IOException
{
DataInputStream stream = new DataInputStream(new FileInputStream(filterFilename()));
bf = BloomFilter.serializer().deserialize(stream);
try
{
bf = BloomFilter.serializer().deserialize(stream);
}
finally
{
stream.close();
}
}
private void loadIndexFile() throws IOException
{
BufferedRandomAccessFile input = new BufferedRandomAccessFile(indexFilename(), "r");
indexPositions = new ArrayList<KeyPosition>();
int i = 0;
long indexSize = input.length();
while (true)
try
{
long indexPosition = input.getFilePointer();
if (indexPosition == indexSize)
indexPositions = new ArrayList<KeyPosition>();
int i = 0;
long indexSize = input.length();
while (true)
{
break;
}
DecoratedKey decoratedKey = partitioner.convertFromDiskFormat(input.readUTF());
input.readLong();
if (i++ % INDEX_INTERVAL == 0)
{
indexPositions.add(new KeyPosition(decoratedKey, indexPosition));
long indexPosition = input.getFilePointer();
if (indexPosition == indexSize)
{
break;
}
DecoratedKey decoratedKey = partitioner.convertFromDiskFormat(input.readUTF());
input.readLong();
if (i++ % INDEX_INTERVAL == 0)
{
indexPositions.add(new KeyPosition(decoratedKey, indexPosition));
}
}
}
finally
{
input.close();
}
}
/** get the position in the index file to start scanning to find the given key (at most indexInterval keys away) */