Class ResultSubpartition
java.lang.Object
org.apache.flink.runtime.io.network.partition.ResultSubpartition
- Direct Known Subclasses:
PipelinedSubpartition
A single subpartition of a
ResultPartition instance.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classA combination of aBufferand the backlog length indicating how many non-event buffers are available in the subpartition. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intprotected final ResultPartitionThe parent partition this subpartition belongs to.protected final ResultSubpartitionInfoThe info of the subpartition to identify it globally within a task. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract voidabortCheckpoint(long checkpointId, CheckpointException cause) final intadd(BufferConsumer bufferConsumer) abstract intadd(BufferConsumer bufferConsumer, int partialRecordLength) Adds the given buffer.abstract voidalignedBarrierTimeout(long checkpointId) abstract voidbufferSize(int desirableNewBufferSize) abstract ResultSubpartitionViewcreateReadView(BufferAvailabilityListener availabilityListener) abstract intfinish()Writing of data is finished.abstract voidflush()abstract intGet the current size of the queue.intprotected abstract longGets the total numbers of buffers (data buffers plus events).protected abstract longabstract booleanprotected voidNotifies the parent partition about a consumedResultSubpartitionView.abstract voidrelease()abstract intMakes a best effort to get the current size of the queue.
-
Field Details
-
ADD_BUFFER_ERROR_CODE
public static final int ADD_BUFFER_ERROR_CODE- See Also:
-
subpartitionInfo
The info of the subpartition to identify it globally within a task. -
parent
The parent partition this subpartition belongs to.
-
-
Constructor Details
-
ResultSubpartition
-
-
Method Details
-
getSubpartitionInfo
-
getTotalNumberOfBuffersUnsafe
protected abstract long getTotalNumberOfBuffersUnsafe()Gets the total numbers of buffers (data buffers plus events). -
getTotalNumberOfBytesUnsafe
protected abstract long getTotalNumberOfBytesUnsafe() -
getSubPartitionIndex
public int getSubPartitionIndex() -
onConsumedSubpartition
protected void onConsumedSubpartition()Notifies the parent partition about a consumedResultSubpartitionView. -
alignedBarrierTimeout
- Throws:
IOException
-
abortCheckpoint
-
add
- Throws:
IOException
-
add
Adds 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.- 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
ADD_BUFFER_ERROR_CODEif the add operation fails. - Throws:
IOException- thrown in case of errors while adding the buffer
-
flush
public abstract void flush() -
finish
Writing of data is finished.- Returns:
- the size of data written for this subpartition inside of finish.
- Throws:
IOException
-
release
- Throws:
IOException
-
createReadView
public abstract ResultSubpartitionView createReadView(BufferAvailabilityListener availabilityListener) throws IOException - Throws:
IOException
-
isReleased
public abstract boolean isReleased() -
unsynchronizedGetNumberOfQueuedBuffers
public abstract int unsynchronizedGetNumberOfQueuedBuffers()Makes 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. -
getNumberOfQueuedBuffers
public abstract int getNumberOfQueuedBuffers()Get the current size of the queue. -
bufferSize
public abstract void bufferSize(int desirableNewBufferSize)
-