Interface ResultSubpartitionView
- All Known Implementing Classes:
BoundedBlockingSubpartitionDirectTransferReader,NoOpResultSubpartitionView,PipelinedApproximateSubpartitionView,PipelinedSubpartitionView,TieredStorageResultSubpartitionView,UnionResultSubpartitionView
public interface ResultSubpartitionView
A view to consume a
ResultSubpartition instance.-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classAvailability of theResultSubpartitionViewand the backlog in the correspondingResultSubpartition. -
Method Summary
Modifier and TypeMethodDescriptionvoidgetAvailabilityAndBacklog(boolean isCreditAvailable) Get the availability and backlog of the view.ResultSubpartitionViewcan decide whether the failure cause should be reported to consumer as failure (primary failure) orProducerFailedException(secondary failure).Returns the nextBufferinstance of this queue iterator.intbooleanvoidvoidnotifyNewBufferSize(int newBufferSize) default voidnotifyPriorityEvent(int priorityBufferNumber) default voidnotifyRequiredSegmentId(int subpartitionId, int segmentId) In tiered storage shuffle mode, only required segments will be sent to prevent the redundant buffer usage.intReturns the index of the subpartition where the next buffer locates, or -1 if there is no buffer available and the subpartition to be consumed is not determined.voidvoidint
-
Method Details
-
getNextBuffer
Returns the nextBufferinstance of this queue iterator.If there is currently no instance available, it will return
null. This might happen for example when a pipelined queue producer is slower than the consumer or a spilled queue needs to read in more data.Important: The consumer has to make sure that each buffer instance will eventually be recycled with
Buffer.recycleBuffer()after it has been consumed.- Throws:
IOException
-
notifyDataAvailable
void notifyDataAvailable() -
notifyPriorityEvent
default void notifyPriorityEvent(int priorityBufferNumber) -
releaseAllResources
- Throws:
IOException
-
isReleased
boolean isReleased() -
resumeConsumption
void resumeConsumption() -
acknowledgeAllDataProcessed
void acknowledgeAllDataProcessed() -
getFailureCause
Throwable getFailureCause()ResultSubpartitionViewcan decide whether the failure cause should be reported to consumer as failure (primary failure) orProducerFailedException(secondary failure). Secondary failure can be reported only if producer (upstream task) is guaranteed to failover.BEWARE: Incorrectly reporting failure cause as primary failure, can hide the root cause of the failure from the user.
-
getAvailabilityAndBacklog
Get the availability and backlog of the view. The availability represents if the view is ready to get buffer from it. The backlog represents the number of available data buffers.- Parameters:
isCreditAvailable- the availability of credits for thisResultSubpartitionView.- Returns:
- availability and backlog.
-
unsynchronizedGetNumberOfQueuedBuffers
int unsynchronizedGetNumberOfQueuedBuffers() -
getNumberOfQueuedBuffers
int getNumberOfQueuedBuffers() -
notifyNewBufferSize
void notifyNewBufferSize(int newBufferSize) -
notifyRequiredSegmentId
default void notifyRequiredSegmentId(int subpartitionId, int segmentId) In tiered storage shuffle mode, only required segments will be sent to prevent the redundant buffer usage. Downstream will notify the upstream by this method to send required segments.- Parameters:
subpartitionId- The id of the corresponding subpartition.segmentId- The id of required segment.
-
peekNextBufferSubpartitionId
Returns the index of the subpartition where the next buffer locates, or -1 if there is no buffer available and the subpartition to be consumed is not determined.- Throws:
IOException
-