public class PipelinedSubpartition extends ResultSubpartition implements ChannelStateHolder
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.
ResultSubpartition.BufferAndBacklogADD_BUFFER_ERROR_CODE, parent, subpartitionInfo| Modifier and Type | Method and Description |
|---|---|
void |
abortCheckpoint(long checkpointId,
CheckpointException cause) |
void |
acknowledgeAllDataProcessed() |
int |
add(BufferConsumer bufferConsumer,
int partialRecordLength)
Adds the given buffer.
|
void |
alignedBarrierTimeout(long checkpointId) |
void |
bufferSize(int desirableNewBufferSize) |
PipelinedSubpartitionView |
createReadView(BufferAvailabilityListener availabilityListener) |
int |
finish()
Writing of data is finished.
|
void |
flush() |
ResultSubpartitionView.AvailabilityWithBacklog |
getAvailabilityAndBacklog(boolean isCreditAvailable) |
int |
getBuffersInBacklogUnsafe()
Gets the number of non-event buffers in this subpartition.
|
long |
getChannelStateCheckpointId() |
int |
getNumberOfQueuedBuffers()
Get the current size of the queue.
|
protected long |
getTotalNumberOfBuffersUnsafe()
Gets the total numbers of buffers (data buffers plus events).
|
protected long |
getTotalNumberOfBytesUnsafe() |
boolean |
isReleased() |
boolean |
isSupportChannelStateRecover() |
void |
release() |
void |
setChannelStateWriter(ChannelStateWriter channelStateWriter)
Injects the
ChannelStateWriter. |
String |
toString() |
int |
unsynchronizedGetNumberOfQueuedBuffers()
Makes a best effort to get the current size of the queue.
|
add, getSubPartitionIndex, getSubpartitionInfo, onConsumedSubpartitionpublic void setChannelStateWriter(ChannelStateWriter channelStateWriter)
ChannelStateHolderChannelStateWriter. Must only be called once.setChannelStateWriter in interface ChannelStateHolderpublic int add(BufferConsumer bufferConsumer, int partialRecordLength)
ResultSubpartitionThe 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.
add in class ResultSubpartitionbufferConsumer - 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 .ResultSubpartition.ADD_BUFFER_ERROR_CODE if
the add operation fails.public boolean isSupportChannelStateRecover()
public int finish()
throws IOException
ResultSubpartitionfinish in class ResultSubpartitionIOExceptionpublic void alignedBarrierTimeout(long checkpointId)
throws IOException
alignedBarrierTimeout in class ResultSubpartitionIOExceptionpublic void abortCheckpoint(long checkpointId,
CheckpointException cause)
abortCheckpoint in class ResultSubpartitionpublic void release()
release in class ResultSubpartitionpublic void acknowledgeAllDataProcessed()
public boolean isReleased()
isReleased in class ResultSubpartitionpublic PipelinedSubpartitionView createReadView(BufferAvailabilityListener availabilityListener)
createReadView in class ResultSubpartitionpublic ResultSubpartitionView.AvailabilityWithBacklog getAvailabilityAndBacklog(boolean isCreditAvailable)
public int getNumberOfQueuedBuffers()
ResultSubpartitiongetNumberOfQueuedBuffers in class ResultSubpartitionpublic void bufferSize(int desirableNewBufferSize)
bufferSize in class ResultSubpartitionpublic int unsynchronizedGetNumberOfQueuedBuffers()
ResultSubpartitionunsynchronizedGetNumberOfQueuedBuffers in class ResultSubpartitionpublic void flush()
flush in class ResultSubpartitionprotected long getTotalNumberOfBuffersUnsafe()
ResultSubpartitiongetTotalNumberOfBuffersUnsafe in class ResultSubpartitionprotected long getTotalNumberOfBytesUnsafe()
getTotalNumberOfBytesUnsafe in class ResultSubpartitionpublic int getBuffersInBacklogUnsafe()
@VisibleForTesting public long getChannelStateCheckpointId()
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.