Class PipelinedSubpartition
- All Implemented Interfaces:
ChannelStateHolder
- Direct Known Subclasses:
PipelinedApproximateSubpartition
Whenever ResultSubpartition.add(BufferConsumer) adds a finished BufferConsumer
or a second BufferConsumer (in which case we will assume the first one finished), we will
notify a read view created via ResultSubpartition.createReadView(BufferAvailabilityListener) of new data availability. Except
by calling flush() explicitly, we always only notify when the first finished buffer
turns up and then, the reader has to drain the buffers via pollBuffer() until its return
value shows no more buffers being available. This results in a buffer queue which is either empty
or has an unfinished BufferConsumer left from which the notifications will eventually
start again.
Explicit calls to flush() will force this notification for any BufferConsumer
present in the queue.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.flink.runtime.io.network.partition.ResultSubpartition
ResultSubpartition.BufferAndBacklog -
Field Summary
Fields inherited from class org.apache.flink.runtime.io.network.partition.ResultSubpartition
ADD_BUFFER_ERROR_CODE, parent, subpartitionInfo -
Method Summary
Modifier and TypeMethodDescriptionvoidabortCheckpoint(long checkpointId, CheckpointException cause) voidintadd(BufferConsumer bufferConsumer, int partialRecordLength) Adds the given buffer.voidalignedBarrierTimeout(long checkpointId) voidbufferSize(int desirableNewBufferSize) createReadView(BufferAvailabilityListener availabilityListener) intfinish()Writing of data is finished.voidflush()getAvailabilityAndBacklog(boolean isCreditAvailable) intGets the number of non-event buffers in this subpartition.longintGet the current size of the queue.protected longGets the total numbers of buffers (data buffers plus events).protected longbooleanbooleanvoidrelease()voidsetChannelStateWriter(ChannelStateWriter channelStateWriter) Injects theChannelStateWriter.toString()intMakes a best effort to get the current size of the queue.Methods inherited from class org.apache.flink.runtime.io.network.partition.ResultSubpartition
add, getSubPartitionIndex, getSubpartitionInfo, onConsumedSubpartition
-
Method Details
-
setChannelStateWriter
Description copied from interface:ChannelStateHolderInjects theChannelStateWriter. Must only be called once.- Specified by:
setChannelStateWriterin interfaceChannelStateHolder
-
add
Description copied from class:ResultSubpartitionAdds the given buffer.The request may be executed synchronously, or asynchronously, depending on the implementation.
IMPORTANT: Before adding new
BufferConsumerpreviously added must be in finished state. Because of the performance reasons, this is only enforced during the data reading. Priority events can be added while the previous buffer consumer is still open, in which case the open buffer consumer is overtaken.- Specified by:
addin classResultSubpartition- Parameters:
bufferConsumer- the buffer to add (transferring ownership to this writer)partialRecordLength- the length of bytes to skip in order to start with a complete record, from position index 0 of the underlying .- Returns:
- the preferable buffer size for this subpartition or
ResultSubpartition.ADD_BUFFER_ERROR_CODEif the add operation fails.
-
isSupportChannelStateRecover
public boolean isSupportChannelStateRecover() -
finish
Description copied from class:ResultSubpartitionWriting of data is finished.- Specified by:
finishin classResultSubpartition- Returns:
- the size of data written for this subpartition inside of finish.
- Throws:
IOException
-
alignedBarrierTimeout
- Specified by:
alignedBarrierTimeoutin classResultSubpartition- Throws:
IOException
-
abortCheckpoint
- Specified by:
abortCheckpointin classResultSubpartition
-
release
public void release()- Specified by:
releasein classResultSubpartition
-
acknowledgeAllDataProcessed
public void acknowledgeAllDataProcessed() -
isReleased
public boolean isReleased()- Specified by:
isReleasedin classResultSubpartition
-
createReadView
- Specified by:
createReadViewin classResultSubpartition
-
getAvailabilityAndBacklog
public ResultSubpartitionView.AvailabilityWithBacklog getAvailabilityAndBacklog(boolean isCreditAvailable) -
getNumberOfQueuedBuffers
public int getNumberOfQueuedBuffers()Description copied from class:ResultSubpartitionGet the current size of the queue.- Specified by:
getNumberOfQueuedBuffersin classResultSubpartition
-
bufferSize
public void bufferSize(int desirableNewBufferSize) - Specified by:
bufferSizein classResultSubpartition
-
toString
-
unsynchronizedGetNumberOfQueuedBuffers
public int unsynchronizedGetNumberOfQueuedBuffers()Description copied from class:ResultSubpartitionMakes a best effort to get the current size of the queue. This method must not acquire locks or interfere with the task and network threads in any way.- Specified by:
unsynchronizedGetNumberOfQueuedBuffersin classResultSubpartition
-
flush
public void flush()- Specified by:
flushin classResultSubpartition
-
getTotalNumberOfBuffersUnsafe
protected long getTotalNumberOfBuffersUnsafe()Description copied from class:ResultSubpartitionGets the total numbers of buffers (data buffers plus events).- Specified by:
getTotalNumberOfBuffersUnsafein classResultSubpartition
-
getTotalNumberOfBytesUnsafe
protected long getTotalNumberOfBytesUnsafe()- Specified by:
getTotalNumberOfBytesUnsafein classResultSubpartition
-
getBuffersInBacklogUnsafe
public int getBuffersInBacklogUnsafe()Gets the number of non-event buffers in this subpartition. -
getChannelStateCheckpointId
@VisibleForTesting public long getChannelStateCheckpointId()
-