This is an automated email from the ASF dual-hosted git repository. pnowojski pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/flink.git
commit 071128a0297d0ecdde573107ea16d78693783701 Author: Piotr Nowojski <[email protected]> AuthorDate: Wed Oct 17 12:01:16 2018 +0200 [hotfix][network] Make prune auto clear the buffer It makes it more consistent and explicit. Previously it was assumed that buffer is clear before pruning and it was used that way, but theretically prune that's not proceeded/followed by clear would result in incosistent state and position that points to non existing data. --- .../java/org/apache/flink/core/memory/DataOutputSerializer.java | 1 + .../runtime/io/network/api/serialization/RecordSerializer.java | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/flink-core/src/main/java/org/apache/flink/core/memory/DataOutputSerializer.java b/flink-core/src/main/java/org/apache/flink/core/memory/DataOutputSerializer.java index 7738a30..01feae0 100644 --- a/flink-core/src/main/java/org/apache/flink/core/memory/DataOutputSerializer.java +++ b/flink-core/src/main/java/org/apache/flink/core/memory/DataOutputSerializer.java @@ -108,6 +108,7 @@ public class DataOutputSerializer implements DataOutputView { } public void pruneBuffer() { + clear(); if (this.buffer.length > PRUNE_BUFFER_THRESHOLD) { if (LOG.isDebugEnabled()) { LOG.debug("Releasing serialization buffer of " + this.buffer.length + " bytes."); diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/api/serialization/RecordSerializer.java b/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/api/serialization/RecordSerializer.java index 6eebbbe..c0cf35d 100644 --- a/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/api/serialization/RecordSerializer.java +++ b/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/api/serialization/RecordSerializer.java @@ -82,9 +82,9 @@ public interface RecordSerializer<T extends IOReadableWritable> { SerializationResult copyToBufferBuilder(BufferBuilder bufferBuilder); /** - * Checks to decrease the size of intermediate data serialization buffer after finishing the - * whole serialization process including {@link #serializeRecord(IOReadableWritable)} and - * {@link #copyToBufferBuilder(BufferBuilder)}. + * Clears the buffer and checks to decrease the size of intermediate data serialization buffer + * after finishing the whole serialization process including + * {@link #serializeRecord(IOReadableWritable)} and {@link #copyToBufferBuilder(BufferBuilder)}. */ void prune();
