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#UnfilteredRowIterator
into 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 {UnfilteredRowIterator
only last till next call toAbstractIterator.next()
. A subsequentAbstractIterator.next
call 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 void
close()
protected UnfilteredRowIterator
computeNext()
static CloseableIterator<UnfilteredRowIterator>
throttle(UnfilteredPartitionIterator partitionIterator, int maxBatchSize)
Splits aUnfilteredPartitionIterator
inUnfilteredRowIterator
batches 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:
computeNext
in classAbstractIterator<UnfilteredRowIterator>
-
close
public void close()
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfaceCloseableIterator<UnfilteredRowIterator>
- Overrides:
close
in classAbstractIterator<UnfilteredRowIterator>
-
throttle
public static CloseableIterator<UnfilteredRowIterator> throttle(UnfilteredPartitionIterator partitionIterator, int maxBatchSize)
Splits aUnfilteredPartitionIterator
inUnfilteredRowIterator
batches 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:
-
-