Package org.apache.cassandra.db.rows
Class ThrottledUnfilteredIterator
- java.lang.Object
-
- org.apache.cassandra.utils.AbstractIterator<UnfilteredRowIterator>
-
- org.apache.cassandra.db.rows.ThrottledUnfilteredIterator
-
- All Implemented Interfaces:
com.google.common.collect.PeekingIterator<UnfilteredRowIterator>,java.lang.AutoCloseable,java.util.Iterator<UnfilteredRowIterator>,CloseableIterator<UnfilteredRowIterator>
public class ThrottledUnfilteredIterator extends AbstractIterator<UnfilteredRowIterator> implements CloseableIterator<UnfilteredRowIterator>
A utility class to split the given#UnfilteredRowIteratorinto smaller chunks each having at mostthrottle+ 1 unfiltereds. Only the first output contains partition level info:UnfilteredRowIterator.partitionLevelDeletion()andBaseRowIterator.staticRow(). Besides splitting, this iterator will also ensure each chunk does not finish with an open tombstone marker, by closing any opened tombstone markers and re-opening on the next chunk. The lifecycle of outputed {UnfilteredRowIteratoronly last till next call toAbstractIterator.next(). A subsequentAbstractIterator.nextcall will exhaust the previously returned iterator before computing the next, effectively skipping unfiltereds up to the throttle size. Closing this iterator will close the underlying iterator.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()protected UnfilteredRowIteratorcomputeNext()static CloseableIterator<UnfilteredRowIterator>throttle(UnfilteredPartitionIterator partitionIterator, int maxBatchSize)Splits aUnfilteredPartitionIteratorinUnfilteredRowIteratorbatches with size no higher than maxBatchSize-
Methods inherited from class org.apache.cassandra.utils.AbstractIterator
endOfData, hasNext, next, peek, remove
-
-
-
-
Method Detail
-
computeNext
protected UnfilteredRowIterator computeNext()
- Specified by:
computeNextin classAbstractIterator<UnfilteredRowIterator>
-
close
public void close()
- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfaceCloseableIterator<UnfilteredRowIterator>- Overrides:
closein classAbstractIterator<UnfilteredRowIterator>
-
throttle
public static CloseableIterator<UnfilteredRowIterator> throttle(UnfilteredPartitionIterator partitionIterator, int maxBatchSize)
Splits aUnfilteredPartitionIteratorinUnfilteredRowIteratorbatches with size no higher than maxBatchSize- Parameters:
partitionIterator-maxBatchSize- max number of unfiltereds in the UnfilteredRowIterator. if 0 is given, it means no throttle.- Returns:
-
-