use of org.bboxdb.commons.SortedIteratorMerger in project bboxdb by jnidzwetzki.
the class SSTableCompactor method executeCompactation.
/**
* Execute the compactation of the input sstables
*
* @return success or failure
*/
public void executeCompactation() throws StorageManagerException {
try {
// The iterators
final List<Iterator<Tuple>> iterators = sstableIndexReader.stream().map(r -> r.iterator()).collect(Collectors.toList());
final DuplicateResolver<Tuple> newestKeyResolver = TupleDuplicateResolverFactory.build(tupleStoreManager.getTupleStoreConfiguration());
final SortedIteratorMerger<Tuple> sortedIteratorMerger = new SortedIteratorMerger<>(iterators, TupleHelper.TUPLE_KEY_COMPARATOR, newestKeyResolver);
for (final Tuple tuple : sortedIteratorMerger) {
checkForThreadTermination();
addTupleToWriter(tuple);
}
readTuples = sortedIteratorMerger.getReadElements();
} catch (StorageManagerException e) {
handleErrorDuringCompact();
throw e;
} finally {
closeSSTableWriter();
}
}
Aggregations