[
https://issues.apache.org/jira/browse/FLINK-5059?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15719996#comment-15719996
]
ASF GitHub Bot commented on FLINK-5059:
---------------------------------------
Github user uce commented on a diff in the pull request:
https://github.com/apache/flink/pull/2805#discussion_r90778003
--- Diff:
flink-runtime/src/test/java/org/apache/flink/runtime/io/network/api/writer/RecordWriterTest.java
---
@@ -421,22 +423,19 @@ private ResultPartitionWriter
createCollectingPartitionWriter(
@Override
public Void answer(InvocationOnMock invocationOnMock)
throws Throwable {
Buffer buffer = (Buffer)
invocationOnMock.getArguments()[0];
- Integer targetChannel = (Integer)
invocationOnMock.getArguments()[1];
- queues[targetChannel].add(new
BufferOrEvent(buffer, targetChannel));
+ if (buffer.isBuffer()) {
+ Integer targetChannel = (Integer)
invocationOnMock.getArguments()[1];
+ queues[targetChannel].add(new
BufferOrEvent(buffer, targetChannel));
+ } else {
+ // is event:
+ AbstractEvent event =
EventSerializer.fromBuffer(buffer, getClass().getClassLoader());
+ Integer targetChannel = (Integer)
invocationOnMock.getArguments()[1];
--- End diff --
Was missing before, too, but we should recycle the buffer after creating
the event.
> only serialise events once in RecordWriter#broadcastEvent
> ---------------------------------------------------------
>
> Key: FLINK-5059
> URL: https://issues.apache.org/jira/browse/FLINK-5059
> Project: Flink
> Issue Type: Improvement
> Components: Network
> Reporter: Nico Kruber
> Assignee: Nico Kruber
>
> Currently,
> org.apache.flink.runtime.io.network.api.writer.RecordWriter#broadcastEvent
> serialises the event once per target channel. Instead, it could serialise the
> event only once and use the serialised form for every channel and thus save
> resources.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)