Class BatchShuffleReadBufferPool

java.lang.Object
org.apache.flink.runtime.io.disk.BatchShuffleReadBufferPool

public class BatchShuffleReadBufferPool extends Object
A fixed-size MemorySegment pool used by batch shuffle for shuffle data read (currently only used by sort-merge blocking shuffle).
  • Field Details

    • NUM_BYTES_PER_REQUEST

      public static final int NUM_BYTES_PER_REQUEST
      Memory size in bytes can be allocated from this buffer pool for a single request (4M is for better sequential read).
      See Also:
  • Constructor Details

    • BatchShuffleReadBufferPool

      public BatchShuffleReadBufferPool(long totalBytes, int bufferSize)
  • Method Details

    • getNumTotalBuffers

      @VisibleForTesting public int getNumTotalBuffers()
    • getAvailableBuffers

      @VisibleForTesting public int getAvailableBuffers()
    • getNumBuffersPerRequest

      public int getNumBuffersPerRequest()
    • getMaxConcurrentRequests

      public int getMaxConcurrentRequests()
    • getBufferSize

      public int getBufferSize()
    • initialize

      public void initialize()
      Initializes this buffer pool which allocates all the buffers.
    • registerRequester

      public void registerRequester(Object requester)
    • unregisterRequester

      public void unregisterRequester(Object requester)
    • getAverageBuffersPerRequester

      public int getAverageBuffersPerRequester()
    • requestBuffers

      public List<org.apache.flink.core.memory.MemorySegment> requestBuffers() throws Exception
      Requests a collection of buffers (determined by numBuffersPerRequest) from this buffer pool.
      Throws:
      Exception
    • recycle

      public void recycle(org.apache.flink.core.memory.MemorySegment segment)
      Recycles the target buffer to this buffer pool. This method should never throw any exception.
    • recycle

      public void recycle(Collection<org.apache.flink.core.memory.MemorySegment> segments)
      Recycles a collection of buffers to this buffer pool. This method should never throw any exception.
    • getLastBufferOperationTimestamp

      public long getLastBufferOperationTimestamp()
    • destroy

      public void destroy()
      Destroys this buffer pool and after which, no buffer can be allocated any more.
    • isDestroyed

      public boolean isDestroyed()