@Override
    public long getPriority(
            TieredStoragePartitionId partitionId,
            TieredStorageSubpartitionId subpartitionId,
            int segmentId,
            int bufferIndex,
            @Nullable ReadProgress readProgress)
            throws IOException {
        lazyInitializeFileChannel();

        ProducerMergedReadProgress progress = convertToCurrentReadProgress(readProgress);
        if (progress != null
                && progress.getCurrentBufferOffset() != progress.getEndOfRegionOffset()) {
            return progress.getCurrentBufferOffset();
        }
        return dataIndex
                .getRegion(subpartitionId, bufferIndex)
                .map(ProducerMergedPartitionFileIndex.FixedSizeRegion::getRegionStartOffset)
                .orElse(Long.MAX_VALUE);
    }
@Test
    void testGetPriority() throws IOException {
        ProducerMergedPartitionFileReader.ProducerMergedReadProgress readProgress = null;
        CompositeBuffer partialBuffer = null;
        for (int bufferIndex = 0; bufferIndex < DEFAULT_BUFFER_NUMBER; ) {
            PartitionFileReader.ReadBufferResult readBufferResult =
                    readBuffer(bufferIndex, DEFAULT_SUBPARTITION_ID, readProgress, partialBuffer);
            assertThat(readBufferResult).isNotNull();
            assertThat(readBufferResult.getReadProgress())
                    .isInstanceOf(
                            ProducerMergedPartitionFileReader.ProducerMergedReadProgress.class);
            readProgress =
                    (ProducerMergedPartitionFileReader.ProducerMergedReadProgress)
                            readBufferResult.getReadProgress();
            for (Buffer buffer : readBufferResult.getReadBuffers()) {
                if (buffer instanceof CompositeBuffer) {
                    partialBuffer = (CompositeBuffer) buffer;
                    if (partialBuffer.missingLength() == 0) {
                        bufferIndex++;
                        partialBuffer.recycleBuffer();
                        partialBuffer = null;
                    }
                } else {
                    bufferIndex++;
                    buffer.recycleBuffer();
                }
            }

            long expectedBufferOffset;
            if (bufferIndex < DEFAULT_BUFFER_NUMBER) {
                expectedBufferOffset =
                        readProgress == null ? 0 : readProgress.getCurrentBufferOffset();
            } else {
                expectedBufferOffset = Long.MAX_VALUE;
            }
            assertThat(
                            partitionFileReader.getPriority(
                                    DEFAULT_PARTITION_ID,
                                    DEFAULT_SUBPARTITION_ID,
                                    DEFAULT_SEGMENT_ID,
                                    bufferIndex,
                                    readProgress))
                    .isEqualTo(expectedBufferOffset);
        }
    }