boolean readBuffers(Queue<MemorySegment> buffers, BufferRecycler recycler) throws IOException {
        return fileReader.readCurrentRegion(buffers, recycler, this::addBuffer);
    }
@Test
    void testReadBuffers() throws Exception {
        CountingAvailabilityListener listener = new CountingAvailabilityListener();
        SortMergeSubpartitionReader subpartitionReader =
                createSortMergeSubpartitionReader(listener);

        assertThat(listener.numNotifications).isZero();
        assertThat(subpartitionReader.unsynchronizedGetNumberOfQueuedBuffers()).isZero();

        Queue<MemorySegment> segments = createsMemorySegments(2);
        subpartitionReader.readBuffers(segments, FreeingBufferRecycler.INSTANCE);

        assertThat(listener.numNotifications).isEqualTo(1);
        assertThat(subpartitionReader.unsynchronizedGetNumberOfQueuedBuffers()).isEqualTo(1);
        assertThat(segments).isEmpty();

        segments = createsMemorySegments(2);
        subpartitionReader.readBuffers(segments, FreeingBufferRecycler.INSTANCE);

        assertThat(listener.numNotifications).isEqualTo(1);
        assertThat(subpartitionReader.unsynchronizedGetNumberOfQueuedBuffers()).isEqualTo(2);
        assertThat(segments).isEmpty();

        while (subpartitionReader.unsynchronizedGetNumberOfQueuedBuffers() > 0) {
            checkNotNull(subpartitionReader.getNextBuffer()).buffer().recycleBuffer();
        }

        segments = createsMemorySegments(numBuffersPerSubpartition);
        subpartitionReader.readBuffers(segments, FreeingBufferRecycler.INSTANCE);

        assertThat(listener.numNotifications).isEqualTo(2);
        assertThat(subpartitionReader.unsynchronizedGetNumberOfQueuedBuffers())
                .isEqualTo(numBuffersPerSubpartition - 2);
        assertThat(segments.size()).isEqualTo(1);
    }