StefanRRichter commented on a change in pull request #8361: 
[FLINK-12434][network] Replace listeners with CompletableFuture in InputGates
URL: https://github.com/apache/flink/pull/8361#discussion_r282020025
 
 

 ##########
 File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/consumer/SingleInputGate.java
 ##########
 @@ -551,21 +551,20 @@ public void requestPartitions() throws IOException, 
InterruptedException {
                                }
 
                                currentChannel = inputChannelsWithData.remove();
-                               
enqueuedInputChannelsWithData.clear(currentChannel.getChannelIndex());
+
+                               result = currentChannel.getNextBuffer();
+
+                               if (result.isPresent() && 
result.get().moreAvailable()) {
+                                       // enqueue the currentChannel at the 
end to avoid starvation
+                                       
inputChannelsWithData.add(currentChannel);
+                               } else {
+                                       
enqueuedInputChannelsWithData.clear(currentChannel.getChannelIndex());
+                               }
+
                                moreAvailable = 
!inputChannelsWithData.isEmpty();
                        }
-
-                       result = currentChannel.getNextBuffer();
                } while (!result.isPresent());
 
-               // this channel was now removed from the non-empty channels 
queue
-               // we re-add it in case it has more data, because in that case 
no "non-empty" notification
-               // will come for that channel
-               if (result.get().moreAvailable()) {
-                       queueChannel(currentChannel);
-                       moreAvailable = true;
-               }
-
                final Buffer buffer = result.get().buffer();
 
 Review comment:
   I would consider if this method can be split up into multiple smaller 
methods, e.g. the part from this line looks like it could be separated.

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


With regards,
Apache Git Services

Reply via email to