Class ResultSubpartition
- java.lang.Object
-
- org.apache.flink.runtime.io.network.partition.ResultSubpartition
-
- Direct Known Subclasses:
PipelinedSubpartition
public abstract class ResultSubpartition extends Object
A single subpartition of aResultPartition
instance.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ResultSubpartition.BufferAndBacklog
A combination of aBuffer
and the backlog length indicating how many non-event buffers are available in the subpartition.
-
Field Summary
Fields Modifier and Type Field Description static int
ADD_BUFFER_ERROR_CODE
protected ResultPartition
parent
The parent partition this subpartition belongs to.protected ResultSubpartitionInfo
subpartitionInfo
The info of the subpartition to identify it globally within a task.
-
Constructor Summary
Constructors Constructor Description ResultSubpartition(int index, ResultPartition parent)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract void
abortCheckpoint(long checkpointId, CheckpointException cause)
int
add(BufferConsumer bufferConsumer)
abstract int
add(BufferConsumer bufferConsumer, int partialRecordLength)
Adds the given buffer.abstract void
alignedBarrierTimeout(long checkpointId)
abstract void
bufferSize(int desirableNewBufferSize)
abstract ResultSubpartitionView
createReadView(BufferAvailabilityListener availabilityListener)
abstract int
finish()
Writing of data is finished.abstract void
flush()
abstract int
getNumberOfQueuedBuffers()
Get the current size of the queue.int
getSubPartitionIndex()
ResultSubpartitionInfo
getSubpartitionInfo()
protected abstract long
getTotalNumberOfBuffersUnsafe()
Gets the total numbers of buffers (data buffers plus events).protected abstract long
getTotalNumberOfBytesUnsafe()
abstract boolean
isReleased()
protected void
onConsumedSubpartition()
Notifies the parent partition about a consumedResultSubpartitionView
.abstract void
release()
abstract int
unsynchronizedGetNumberOfQueuedBuffers()
Makes a best effort to get the current size of the queue.
-
-
-
Field Detail
-
ADD_BUFFER_ERROR_CODE
public static final int ADD_BUFFER_ERROR_CODE
- See Also:
- Constant Field Values
-
subpartitionInfo
protected final ResultSubpartitionInfo subpartitionInfo
The info of the subpartition to identify it globally within a task.
-
parent
protected final ResultPartition parent
The parent partition this subpartition belongs to.
-
-
Constructor Detail
-
ResultSubpartition
public ResultSubpartition(int index, ResultPartition parent)
-
-
Method Detail
-
getSubpartitionInfo
public ResultSubpartitionInfo 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
public abstract void alignedBarrierTimeout(long checkpointId) throws IOException
- Throws:
IOException
-
abortCheckpoint
public abstract void abortCheckpoint(long checkpointId, CheckpointException cause)
-
add
@VisibleForTesting public final int add(BufferConsumer bufferConsumer) throws IOException
- Throws:
IOException
-
add
public abstract int add(BufferConsumer bufferConsumer, int partialRecordLength) throws IOException
Adds the given buffer.The request may be executed synchronously, or asynchronously, depending on the implementation.
IMPORTANT: Before adding new
BufferConsumer
previously 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_CODE
if the add operation fails. - Throws:
IOException
- thrown in case of errors while adding the buffer
-
flush
public abstract void flush()
-
finish
public abstract int finish() throws IOException
Writing of data is finished.- Returns:
- the size of data written for this subpartition inside of finish.
- Throws:
IOException
-
release
public abstract void release() throws IOException
- 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)
-
-