You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by fh...@apache.org on 2016/04/15 19:39:56 UTC

[11/12] flink git commit: [FLINK-3762] [core] Enable Kryo reference tracking

[FLINK-3762] [core] Enable Kryo reference tracking

This closes #1891


Project: http://git-wip-us.apache.org/repos/asf/flink/repo
Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/dc78a747
Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/dc78a747
Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/dc78a747

Branch: refs/heads/master
Commit: dc78a7470a5da086a08140b200a20d840460ef79
Parents: f3d3a44
Author: Andrew Palumbo <ap...@apache.org>
Authored: Thu Apr 14 14:25:46 2016 -0400
Committer: Fabian Hueske <fh...@apache.org>
Committed: Fri Apr 15 19:38:15 2016 +0200

----------------------------------------------------------------------
 .../flink/api/java/typeutils/runtime/kryo/KryoSerializer.java   | 5 ++---
 .../typeutils/runtime/kryo/KryoGenericTypeSerializerTest.java   | 4 ++--
 2 files changed, 4 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flink/blob/dc78a747/flink-core/src/main/java/org/apache/flink/api/java/typeutils/runtime/kryo/KryoSerializer.java
----------------------------------------------------------------------
diff --git a/flink-core/src/main/java/org/apache/flink/api/java/typeutils/runtime/kryo/KryoSerializer.java b/flink-core/src/main/java/org/apache/flink/api/java/typeutils/runtime/kryo/KryoSerializer.java
index d5c2f67..e74e251 100644
--- a/flink-core/src/main/java/org/apache/flink/api/java/typeutils/runtime/kryo/KryoSerializer.java
+++ b/flink-core/src/main/java/org/apache/flink/api/java/typeutils/runtime/kryo/KryoSerializer.java
@@ -327,9 +327,8 @@ public class KryoSerializer<T> extends TypeSerializer<T> {
 		if (this.kryo == null) {
 			this.kryo = getKryoInstance();
 
-			// disable reference tracking. reference tracking is costly, usually unnecessary, and
-			// inconsistent with Flink's own serialization (which does not do reference tracking)
-			kryo.setReferences(false);
+			// Enable reference tracking. 
+			kryo.setReferences(true);
 			
 			// Throwable and all subclasses should be serialized via java serialization
 			kryo.addDefaultSerializer(Throwable.class, new JavaSerializer());

http://git-wip-us.apache.org/repos/asf/flink/blob/dc78a747/flink-core/src/test/java/org/apache/flink/api/java/typeutils/runtime/kryo/KryoGenericTypeSerializerTest.java
----------------------------------------------------------------------
diff --git a/flink-core/src/test/java/org/apache/flink/api/java/typeutils/runtime/kryo/KryoGenericTypeSerializerTest.java b/flink-core/src/test/java/org/apache/flink/api/java/typeutils/runtime/kryo/KryoGenericTypeSerializerTest.java
index 8ff0b1b..12090f8 100644
--- a/flink-core/src/test/java/org/apache/flink/api/java/typeutils/runtime/kryo/KryoGenericTypeSerializerTest.java
+++ b/flink-core/src/test/java/org/apache/flink/api/java/typeutils/runtime/kryo/KryoGenericTypeSerializerTest.java
@@ -160,9 +160,9 @@ public class KryoGenericTypeSerializerTest extends AbstractGenericTypeSerializer
 	}
 
 	@Test
-	public void validateReferenceMappingDisabled() {
+	public void validateReferenceMappingEnabled() {
 		KryoSerializer<String> serializer = new KryoSerializer<>(String.class, new ExecutionConfig());
 		Kryo kryo = serializer.getKryo();
-		assertFalse(kryo.getReferences());
+		assertTrue(kryo.getReferences());
 	}
 }
\ No newline at end of file