if (logger_.isDebugEnabled())
logger_.debug("Expected bloom filter size : " + expectedBloomFilterSize);
SSTableWriter writer;
CompactionIterator ci = new CompactionIterator(sstables, gcBefore); // retain a handle so we can call close()
Iterator nni = new FilterIterator(ci, PredicateUtils.notNullPredicate());
try
{
if (!nni.hasNext())
{
// don't mark compacted in the finally block, since if there _is_ nondeleted data,
// we need to sync it (via closeAndOpen) first, so there is no period during which
// a crash could cause data loss.
ssTables_.markCompacted(sstables);
return 0;
}
String newFilename = new File(compactionFileLocation, getTempSSTableFileName()).getAbsolutePath();
writer = new SSTableWriter(newFilename, expectedBloomFilterSize, StorageService.getPartitioner());
while (nni.hasNext())
{
CompactionIterator.CompactedRow row = (CompactionIterator.CompactedRow) nni.next();
writer.append(row.key, row.buffer);
totalkeysWritten++;
}
}
finally