flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] zhijiangW commented on a change in pull request #6417: [FLINK-9913][runtime] Improve output serialization only once in RecordWriter
Date Wed, 15 Aug 2018 07:58:09 GMT
zhijiangW commented on a change in pull request #6417: [FLINK-9913][runtime] Improve output
serialization only once in RecordWriter
URL: https://github.com/apache/flink/pull/6417#discussion_r210195493

 File path: flink-runtime/src/main/java/org/apache/flink/runtime/io/network/api/serialization/RecordSerializer.java
 @@ -66,29 +66,33 @@ public boolean isFullBuffer() {
-	 * Starts serializing and copying the given record to the target buffer
-	 * (if available).
+	 * Starts serializing the given record to an intermediate data buffer.
 	 * @param record the record to serialize
-	 * @return how much information was written to the target buffer and
-	 *         whether this buffer is full
-	SerializationResult addRecord(T record) throws IOException;
+	void serializeRecord(T record) throws IOException;
 Review comment:
   I agree with not exposing `RecordSerializer`'s internal private fields to `SerializedRecord`
for safe concern.
   Regarding with the way of reference of the `RecordSerializer` directly in `SerializedRecord`.
The whole process in `RecordWriter` may be like this:
   		SerializedRecord  serializedRecord = serializer.serializeRecord(record);
   		for (int targetChannel = 0; targetChannel < numChannels; targetChannel++) {
                           //reset position for multiple copying
   			BufferBuilder bufferBuilder = getBufferBuilder(targetChannel);
   		        CopyingResult result = serializedRecord.copyToBufferBuilder(bufferBuilder);
   The `SerializedRecord` only provides the method of `copyToBufferBuilder` and wraps the
internal class `CopyingResult`, but the actual copying operation is still done in `RecordSerializer`.
So the `RecordSerializer` also needs provide the method `copyToBufferBuilder`. From this point,
we actually do not separate the two steps of `serialization` and `copy` from `RecordSerializer`.
So I think maybe it is not very worth doing that. :)

This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:

With regards,
Apache Git Services

View raw message