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>,AutoCloseable,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 most throttle + 1 unfiltereds.
Only the first output contains partition level info: UnfilteredRowIterator.partitionLevelDeletion()
and BaseRowIterator.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 to AbstractIterator.next().
A subsequent AbstractIterator.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
Modifier and TypeMethodDescriptionvoidclose()protected UnfilteredRowIteratorthrottle(UnfilteredPartitionIterator partitionIterator, int maxBatchSize) Splits aUnfilteredPartitionIteratorinUnfilteredRowIteratorbatches with size no higher than maxBatchSizeMethods inherited from class org.apache.cassandra.utils.AbstractIterator
endOfData, hasNext, next, peek, removeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Iterator
forEachRemaining, hasNext
-
Method Details
-
computeNext
- Specified by:
computeNextin classAbstractIterator<UnfilteredRowIterator>
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- 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:
-