public class PipelinedSubpartition extends ResultSubpartition implements CheckpointedResultSubpartition, 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.BufferAndBacklogparent, subpartitionInfo| 限定符和类型 | 方法和说明 |
|---|---|
void |
abortCheckpoint(long checkpointId,
CheckpointException cause) |
void |
acknowledgeAllDataProcessed() |
int |
add(BufferConsumer bufferConsumer,
int partialRecordLength)
Adds the given buffer.
|
void |
addRecovered(BufferConsumer bufferConsumer) |
void |
alignedBarrierTimeout(long checkpointId) |
void |
bufferSize(int desirableNewBufferSize) |
PipelinedSubpartitionView |
createReadView(BufferAvailabilityListener availabilityListener) |
void |
finish() |
void |
finishReadRecoveredState(boolean notifyAndBlockOnCompletion) |
void |
flush() |
ResultSubpartitionView.AvailabilityWithBacklog |
getAvailabilityAndBacklog(int numCreditsAvailable) |
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() |
void |
release() |
BufferBuilder |
requestBufferBuilderBlocking() |
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, onConsumedSubpartitionclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetSubpartitionInfopublic void setChannelStateWriter(ChannelStateWriter channelStateWriter)
ChannelStateHolderChannelStateWriter. Must only be called once.setChannelStateWriter 在接口中 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 在类中 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 .public void addRecovered(BufferConsumer bufferConsumer) throws IOException
addRecovered 在接口中 CheckpointedResultSubpartitionIOExceptionpublic void finishReadRecoveredState(boolean notifyAndBlockOnCompletion)
throws IOException
public void finish()
throws IOException
finish 在类中 ResultSubpartitionIOExceptionpublic void alignedBarrierTimeout(long checkpointId)
throws IOException
alignedBarrierTimeout 在类中 ResultSubpartitionIOExceptionpublic void abortCheckpoint(long checkpointId,
CheckpointException cause)
abortCheckpoint 在类中 ResultSubpartitionpublic void release()
release 在类中 ResultSubpartitionpublic void acknowledgeAllDataProcessed()
public boolean isReleased()
isReleased 在类中 ResultSubpartitionpublic PipelinedSubpartitionView createReadView(BufferAvailabilityListener availabilityListener)
createReadView 在类中 ResultSubpartitionpublic ResultSubpartitionView.AvailabilityWithBacklog getAvailabilityAndBacklog(int numCreditsAvailable)
public int getNumberOfQueuedBuffers()
ResultSubpartitionpublic void bufferSize(int desirableNewBufferSize)
bufferSize 在类中 ResultSubpartitionpublic int unsynchronizedGetNumberOfQueuedBuffers()
ResultSubpartitionpublic void flush()
flush 在类中 ResultSubpartitionprotected long getTotalNumberOfBuffersUnsafe()
ResultSubpartitionprotected long getTotalNumberOfBytesUnsafe()
public int getBuffersInBacklogUnsafe()
public BufferBuilder requestBufferBuilderBlocking() throws InterruptedException
@VisibleForTesting public long getChannelStateCheckpointId()
Copyright © 2014–2023 The Apache Software Foundation. All rights reserved.