AHeise commented on a change in pull request #13228:
URL: https://github.com/apache/flink/pull/13228#discussion_r476660921



##########
File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/consumer/SingleInputGate.java
##########
@@ -621,61 +626,84 @@ public boolean isFinished() {
                return Optional.of(transformToBufferOrEvent(
                        inputWithData.data.buffer(),
                        inputWithData.moreAvailable,
-                       inputWithData.input));
+                       inputWithData.input,
+                       inputWithData.morePriorityEvents));
        }
 
        private Optional<InputWithData<InputChannel, BufferAndAvailability>> 
waitAndGetNextData(boolean blocking)
                        throws IOException, InterruptedException {
                while (true) {
-                       Optional<InputChannel> inputChannel = 
getChannel(blocking);
-                       if (!inputChannel.isPresent()) {
+                       Optional<InputChannel> inputChannelOpt = 
getChannel(blocking);
+                       if (!inputChannelOpt.isPresent()) {
                                return Optional.empty();
                        }
 
                        // Do not query inputChannel under the lock, to avoid 
potential deadlocks coming from
                        // notifications.
-                       Optional<BufferAndAvailability> result = 
inputChannel.get().getNextBuffer();
+                       final InputChannel inputChannel = inputChannelOpt.get();
+                       Optional<BufferAndAvailability> 
bufferAndAvailabilityOpt = inputChannel.getNextBuffer();
 
                        synchronized (inputChannelsWithData) {
-                               if (result.isPresent() && 
result.get().moreAvailable()) {
+                               if (!bufferAndAvailabilityOpt.isPresent()) {
+                                       if (inputChannelsWithData.isEmpty()) {
+                                               
availabilityHelper.resetUnavailable();
+                                       }
+                                       continue;

Review comment:
       Sry, I will split.




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


Reply via email to