rkhachatryan commented on a change in pull request #15036:
URL: https://github.com/apache/flink/pull/15036#discussion_r583892530



##########
File path: 
flink-runtime/src/test/java/org/apache/flink/runtime/io/network/api/writer/RecordOrEventCollectingResultPartitionWriter.java
##########
@@ -48,7 +50,16 @@ public RecordOrEventCollectingResultPartitionWriter(
 
     @Override
     public void broadcastEvent(AbstractEvent event, boolean isPriorityEvent) 
throws IOException {
-        output.add(event);
+        // Go through the serialization/deserialization to provide better test 
coverage in the
+        // unit tests using test harnesses. Otherwise bugs in event 
serialisation would be only
+        // visible in ITCases or end to end tests.
+        try (BufferConsumer eventBufferConsumer =
+                EventSerializer.toBufferConsumer(event, isPriorityEvent)) {
+            AbstractEvent deserializedEvent =
+                    EventSerializer.fromBuffer(
+                            eventBufferConsumer.build(), 
getClass().getClassLoader());

Review comment:
       I guess `recycleBuffer` isn't mandatory here since it's on-heap buffer, 
but wouldn't heart.




----------------------------------------------------------------
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:
[email protected]


Reply via email to