pnowojski commented on a change in pull request #13741:
URL: https://github.com/apache/flink/pull/13741#discussion_r512854774



##########
File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/consumer/RemoteInputChannel.java
##########
@@ -437,19 +440,20 @@ public void onBuffer(Buffer buffer, int sequenceNumber, 
int backlog) throws IOEx
 
                                wasEmpty = receivedBuffers.isEmpty();
 
-                               if (buffer.getDataType().hasPriority()) {
-                                       receivedBuffers.addPriorityElement(new 
SequenceBuffer(buffer, sequenceNumber));
-                                       if 
(channelStatePersister.checkForBarrier(buffer)) {
-                                               // checkpoint was not yet 
started by task thread,
-                                               // so remember the numbers of 
buffers to spill for the time when it will be started
-                                               numBuffersOvertaken = 
receivedBuffers.getNumUnprioritizedElements();
-                                       }
-                                       firstPriorityEvent = 
receivedBuffers.getNumPriorityElements() == 1;
+                               SequenceBuffer sequenceBuffer = new 
SequenceBuffer(buffer, sequenceNumber);
+                               DataType dataType = buffer.getDataType();
+                               if (dataType.hasPriority()) {
+                                       checkPriorityXorAnnouncement(buffer);
+                                       firstPriorityEvent = 
addPriorityBuffer(sequenceBuffer);
                                } else {
-                                       receivedBuffers.add(new 
SequenceBuffer(buffer, sequenceNumber));
+                                       receivedBuffers.add(sequenceBuffer);
                                        
channelStatePersister.maybePersist(buffer);
-                               }
 
+                                       if (dataType.requiresAnnouncement()) {
+                                               
checkPriorityXorAnnouncement(buffer);
+                                               firstPriorityEvent = 
addPriorityBuffer(announce(sequenceBuffer));
+                                       }

Review comment:
       This is incorrect, it would have to be:
   ```
                                if (dataType.requiresAnnouncement()) {
                                        firstPriorityEvent = 
addPriorityBuffer(announce(sequenceBuffer));
                                }
                                if (dataType.hasPriority()) {
                                        firstPriorityEvent = 
addPriorityBuffer(sequenceBuffer);
                                }
                                else {
                                        receivedBuffers.add(sequenceBuffer);
                                        
channelStatePersister.maybePersist(buffer);
                                }
   ```
   but that would suggest priority event can be announced, hence I moved 
   ```
                                if (dataType.requiresAnnouncement()) {
                                        firstPriorityEvent = 
addPriorityBuffer(announce(sequenceBuffer));
                                }
   ```
   into the non priority branch.




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