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_r402582241
########## File path: flink-runtime/src/main/java/org/apache/flink/runtime/io/network/api/writer/RecordWriter.java ########## @@ -153,13 +153,17 @@ protected boolean copyFromSerializerToTargetChannel(int targetChannel) throws IO return pruneTriggered; } - public void broadcastEvent(AbstractEvent event) throws IOException { + public void broadcastEvent(AbstractEvent event, boolean isPriorityEvent) throws IOException { try (BufferConsumer eventBufferConsumer = EventSerializer.toBufferConsumer(event)) { for (int targetChannel = 0; targetChannel < numberOfChannels; targetChannel++) { tryFinishCurrentBufferBuilder(targetChannel); - // Retain the buffer so that it can be recycled by each channel of targetPartition - targetPartition.addBufferConsumer(eventBufferConsumer.copy(), targetChannel); + if (isPriorityEvent) { + targetPartition.addPriorityEvent(event, targetChannel, eventBufferConsumer); Review comment: My main motivation was to avoid unnecessary (de)serialization. In certain cases (local input channel), you can directly pass the event. In other cases, you need the buffer. So deciding on one would lead to extra work on the other case. For the same reason, `copy()` is not called, as the buffer may not be used at all and a copy is unnecessary work. In general, I think it's up to the consumer to copy a buffer or not. If it can immediately process the buffer, why copy and recycle at all? ---------------------------------------------------------------- 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