AHeise commented on a change in pull request #11507: [FLINK-16587] Add basic CheckpointBarrierHandler for unaligned checkpoint URL: https://github.com/apache/flink/pull/11507#discussion_r408059152
########## File path: flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/consumer/RemoteInputChannel.java ########## @@ -523,15 +557,18 @@ public void onBuffer(Buffer buffer, int sequenceNumber, int backlog) throws IOEx return; } - if (expectedSequenceNumber != sequenceNumber) { - onError(new BufferReorderingException(expectedSequenceNumber, sequenceNumber)); - return; - } - wasEmpty = receivedBuffers.isEmpty(); receivedBuffers.add(buffer); - recycleBuffer = false; + + if (hasListener) { + if (buffer.isBuffer() && receivedCheckpointId < lastRequestedCheckpointId) { + notifyReceivedBuffer = buffer.retainBuffer(); + } else { + notifyReceivedBarrier = parseCheckpointBarrierOrNull(buffer); Review comment: Parsing is only done for events, which are rare and small. To move parsing outside of the `synchronized`, we'd need to copy each event, which also has some cost. Given that we have not performed any benchmark with the current way, I'd say moving things outside is probably a case of premature optimization. ---------------------------------------------------------------- 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