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 a ResultPartition instance.
  • Field Details

    • ADD_BUFFER_ERROR_CODE

      public static final int ADD_BUFFER_ERROR_CODE
      See Also:
    • 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 Details

    • ResultSubpartition

      public ResultSubpartition(int index, ResultPartition parent)
  • Method Details

    • 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 consumed ResultSubpartitionView.
    • 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)