SSTableReader sstable = store.getSSTables().iterator().next();
for (int j = 0; j < 100; j += 2)
{
String key = String.valueOf(j);
DecoratedKey dk = StorageService.getPartitioner().decorateKey(key);
FileDataInput file = sstable.getFileDataInput(dk, DatabaseDescriptor.getIndexedReadBufferSizeInKB() * 1024);
DecoratedKey keyInDisk = sstable.getPartitioner().convertFromDiskFormat(file.readUTF());
assert keyInDisk.equals(dk) : String.format("%s != %s in %s", keyInDisk, dk, file.getPath());
}
// check no false positives
for (int j = 1; j < 110; j += 2)
{
String key = String.valueOf(j);
DecoratedKey dk = StorageService.getPartitioner().decorateKey(key);
assert sstable.getPosition(dk) == null;
}
// check positionsize information
assert sstable.indexSummary.getSpannedIndexDataPositions().entrySet().size() > 0;
for (Map.Entry<IndexSummary.KeyPosition, SSTable.PositionSize> entry : sstable.indexSummary.getSpannedIndexDataPositions().entrySet())
{
IndexSummary.KeyPosition kp = entry.getKey();
SSTable.PositionSize info = entry.getValue();
long nextIndexPosition = kp.indexPosition + 2 + FBUtilities.encodedUTF8Length(StorageService.getPartitioner().convertToDiskFormat(kp.key)) + 8;
BufferedRandomAccessFile indexFile = new BufferedRandomAccessFile(sstable.indexFilename(), "r");
indexFile.seek(nextIndexPosition);
String nextKey = indexFile.readUTF();
BufferedRandomAccessFile file = new BufferedRandomAccessFile(sstable.getFilename(), "r");
file.seek(info.position + info.size);
assertEquals(nextKey, file.readUTF());
}
}