curcur commented on a change in pull request #13501: URL: https://github.com/apache/flink/pull/13501#discussion_r497225677
########## File path: flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/PipelinedApproximateSubpartition.java ########## @@ -0,0 +1,138 @@ +package org.apache.flink.runtime.io.network.partition; + +import org.apache.flink.runtime.io.network.buffer.Buffer; +import org.apache.flink.runtime.io.network.buffer.BufferConsumer; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.annotation.Nullable; + +import static org.apache.flink.util.Preconditions.checkState; + +public class PipelinedApproximateSubpartition extends PipelinedSubpartition { + + private static final Logger LOG = LoggerFactory.getLogger(PipelinedApproximateSubpartition.class); + + private boolean isPartialBuffer = false; + + PipelinedApproximateSubpartition(int index, ResultPartition parent) { + super(index, parent); + } + + public void releaseView() { + readView = null; + isPartialBuffer = true; + isBlockedByCheckpoint = false; + sequenceNumber = 0; + } + + @Override + public PipelinedSubpartitionView createReadView(BufferAvailabilityListener availabilityListener) { + synchronized (buffers) { + checkState(!isReleased); + + // if the view is not released yet + if (readView != null) { + releaseView(); + } + + LOG.debug("{}: Creating read view for subpartition {} of partition {}.", + parent.getOwningTaskName(), getSubPartitionIndex(), parent.getPartitionId()); + + readView = new PipelinedApproximateSubpartitionView(this, availabilityListener); + } + + return readView; + } + + @Nullable + @Override + BufferAndBacklog pollBuffer() { Review comment: I totally agree. If we reach an agreement, I will definitely do that. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org