1996fanrui commented on code in PR #27861:
URL: https://github.com/apache/flink/pull/27861#discussion_r3028783724


##########
flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/consumer/LocalInputChannel.java:
##########
@@ -273,63 +273,7 @@ public Optional<BufferAndAvailability> getNextBuffer() 
throws IOException {
         checkError();
 
         if (!toBeConsumedBuffers.isEmpty()) {
-            // If there is a pending priority event (e.g., unaligned 
checkpoint barrier), fetch it
-            // from subpartitionView first, skipping toBeConsumedBuffers. This 
ensures priority
-            // events are processed immediately even when there are pending 
recovered buffers.
-            if (hasPendingPriorityEvent) {
-                checkState(subpartitionView != null, "No subpartition view 
available");
-                BufferAndBacklog next = subpartitionView.getNextBuffer();
-                checkState(
-                        next != null && 
next.buffer().getDataType().hasPriority(),
-                        "Expected priority event, but got %s",
-                        next == null ? "null" : next.buffer().getDataType());
-
-                // Check for barrier to update channel state persister.
-                // Note: maybePersist is not needed for barriers as they are 
not regular data
-                // buffers.
-                channelStatePersister.checkForBarrier(next.buffer());
-
-                Buffer.DataType expectedNextDataType = next.getNextDataType();
-                if (!expectedNextDataType.hasPriority()) {
-                    // Reset hasPendingPriorityEvent to false if no more 
priority event
-                    hasPendingPriorityEvent = false;
-                    if (!toBeConsumedBuffers.isEmpty()) {
-                        // Correct nextDataType: if toBeConsumedBuffers is not 
empty, the actual
-                        // next
-                        // element to consume is from toBeConsumedBuffers, not 
from subpartitionView
-                        expectedNextDataType = 
toBeConsumedBuffers.peek().buffer().getDataType();
-                    }
-                }
-
-                return getBufferAndAvailability(
-                        new BufferAndBacklog(
-                                next.buffer(),
-                                next.buffersInBacklog(),
-                                expectedNextDataType,
-                                next.getSequenceNumber()));
-            }
-
-            BufferAndBacklog next = toBeConsumedBuffers.removeFirst();
-
-            // If this is the last recovered buffer and nextDataType is NONE,
-            // dynamically check if subpartitionView has data available.
-            // The last buffer's nextDataType was preset to NONE during 
construction,
-            // but subpartitionView may already have data available.
-            if (toBeConsumedBuffers.isEmpty()
-                    && next.getNextDataType() == Buffer.DataType.NONE
-                    && subpartitionView != null) {
-                ResultSubpartitionView.AvailabilityWithBacklog availability =
-                        subpartitionView.getAvailabilityAndBacklog(true);
-                if (availability.isAvailable()) {
-                    next =
-                            new BufferAndBacklog(
-                                    next.buffer(),
-                                    availability.getBacklog(),
-                                    Buffer.DataType.DATA_BUFFER,
-                                    next.getSequenceNumber());
-                }
-            }
-            return getBufferAndAvailability(next);
+            return getNextRecoveredBuffer();

Review Comment:
   Hi, could you clarify which two commits you think should be squashed?        
                                                                                
                            
                                                                                
                                                                                
                                
   All commits in this PR are related to supporting checkpoint for 
LocalInputChannel, but each one addresses a different aspect. I prefer keeping 
them separate so that each commit focuses on a single task, which makes the 
history easier to follow. Happy to discuss if you see it differently.



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to