public class HsSubpartitionFileReaderImpl extends Object implements HsSubpartitionFileReader
HsSubpartitionFileReader.
Note: This class is not thread safe.
| Modifier and Type | Class and Description |
|---|---|
static class |
HsSubpartitionFileReaderImpl.BufferIndexOrError
Indicates a buffer with index or an error.
|
static class |
HsSubpartitionFileReaderImpl.Factory
Factory of
HsSubpartitionFileReader. |
| Constructor and Description |
|---|
HsSubpartitionFileReaderImpl(int subpartitionId,
HsConsumerId consumerId,
FileChannel dataFileChannel,
HsSubpartitionConsumerInternalOperations operations,
HsFileDataIndex dataIndex,
int maxBufferReadAhead,
Consumer<HsSubpartitionFileReader> fileReaderReleaser,
ByteBuffer headerBuf) |
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(HsSubpartitionFileReader that)
Provides priority calculation logic for io scheduler.
|
Optional<ResultSubpartition.BufferAndBacklog> |
consumeBuffer(int nextBufferToConsume,
Collection<Buffer> buffersToRecycle)
Try to consume next buffer.
|
boolean |
equals(Object o) |
void |
fail(Throwable failureCause)
Fail this
HsSubpartitionFileReader caused by failureCause. |
int |
getBacklog()
Get the number of buffers whose
Buffer.DataType is buffer. |
Deque<HsSubpartitionFileReaderImpl.BufferIndexOrError> |
getLoadedBuffers() |
int |
hashCode() |
Buffer.DataType |
peekNextToConsumeDataType(int nextBufferToConsume,
Collection<Buffer> buffersToRecycle)
Get dataType of next buffer to consume.
|
void |
prepareForScheduling()
Refresh downstream consumption progress for another round scheduling of reading.
|
void |
readBuffers(Queue<org.apache.flink.core.memory.MemorySegment> buffers,
BufferRecycler recycler)
Read subpartition data into buffers.
|
void |
releaseDataView()
Release this
HsDataView when related subpartition view is releasing. |
public HsSubpartitionFileReaderImpl(int subpartitionId,
HsConsumerId consumerId,
FileChannel dataFileChannel,
HsSubpartitionConsumerInternalOperations operations,
HsFileDataIndex dataIndex,
int maxBufferReadAhead,
Consumer<HsSubpartitionFileReader> fileReaderReleaser,
ByteBuffer headerBuf)
public void readBuffers(Queue<org.apache.flink.core.memory.MemorySegment> buffers, BufferRecycler recycler) throws IOException
This transfers the ownership of used buffers to this class. It's this class' responsibility to release the buffers using the recycler when no longer needed.
Calling this method does not always use up all the provided buffers. It's this class' decision when to stop reading. Currently, it stops reading when: 1) buffers are used up, or 2) reaches the end of the subpartition data within the region, or 3) enough data have been read ahead the downstream consuming offset.
readBuffers in interface HsSubpartitionFileReaderbuffers - for reading, note that the ownership of the buffer taken out from the queue is
transferred to this class, and the unused buffer must be returned.recycler - to return buffer to read buffer pool.IOExceptionpublic void fail(Throwable failureCause)
HsSubpartitionFileReaderHsSubpartitionFileReader caused by failureCause.fail in interface HsSubpartitionFileReaderfailureCause - represents the reason why it failed.public void prepareForScheduling()
prepareForScheduling in interface HsSubpartitionFileReaderpublic int compareTo(HsSubpartitionFileReader that)
compareTo in interface Comparable<HsSubpartitionFileReader>public Deque<HsSubpartitionFileReaderImpl.BufferIndexOrError> getLoadedBuffers()
public Optional<ResultSubpartition.BufferAndBacklog> consumeBuffer(int nextBufferToConsume, Collection<Buffer> buffersToRecycle) throws Throwable
HsDataViewOnly invoked by consumer thread.
consumeBuffer in interface HsDataViewnextBufferToConsume - next buffer index to consume.buffersToRecycle - buffers to recycle if needed.Optional.empty().Throwablepublic Buffer.DataType peekNextToConsumeDataType(int nextBufferToConsume, Collection<Buffer> buffersToRecycle)
HsDataViewpeekNextToConsumeDataType in interface HsDataViewnextBufferToConsume - next buffer index to consumebuffersToRecycle - buffers to recycle if needed.Buffer.DataType.NONE.public void releaseDataView()
HsDataViewHsDataView when related subpartition view is releasing.releaseDataView in interface HsDataViewpublic int getBacklog()
HsDataViewBuffer.DataType is buffer.getBacklog in interface HsDataViewCopyright © 2014–2025 The Apache Software Foundation. All rights reserved.