wsry commented on a change in pull request #11877:
URL: https://github.com/apache/flink/pull/11877#discussion_r661992459



##########
File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/BoundedBlockingSubpartitionDirectTransferReader.java
##########
@@ -91,10 +91,14 @@ public BufferAndBacklog getNextBuffer() throws IOException {
 
         updateStatistics(current);
 
-        // We simply assume all the data are non-events for batch jobs to 
avoid pre-fetching the
-        // next header
-        Buffer.DataType nextDataType =
-                numDataAndEventBuffers > 0 ? Buffer.DataType.DATA_BUFFER : 
Buffer.DataType.NONE;
+        // We simply assume all the data except for the last one 
(EndOfPartitionEvent)
+        // are non-events for batch jobs to avoid pre-fetching the next header
+        Buffer.DataType nextDataType = Buffer.DataType.NONE;
+        if (numDataBuffers > 0) {
+            nextDataType = Buffer.DataType.DATA_BUFFER;
+        } else if (numDataAndEventBuffers > 0) {
+            nextDataType = Buffer.DataType.EVENT_BUFFER;
+        }

Review comment:
       An EVENT_BUFFER does not need any credit to be sent. The 
BoundedBlockingSubpartitionDirectTransferReader Implementation does not 
distinguish EVENT_BUFFER and DATA_BUFFER for simplicity. However, after this 
change, we need to distinguish EVENT_BUFFER and DATA_BUFFER because we do not 
want to allocate any credit at downstream for an EVENT_BUFFER.




-- 
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: issues-unsubscr...@flink.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to