flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] StefanRRichter commented on a change in pull request #7061: [FLINK-10827][tests] Add test for duplicate() to SerializerTestBase
Date Fri, 09 Nov 2018 13:18:53 GMT
StefanRRichter commented on a change in pull request #7061: [FLINK-10827][tests] Add test for
duplicate() to SerializerTestBase
URL: https://github.com/apache/flink/pull/7061#discussion_r232249327
 
 

 ##########
 File path: flink-core/src/main/java/org/apache/flink/api/java/typeutils/runtime/PojoSerializer.java
 ##########
 @@ -181,11 +181,13 @@ public boolean isImmutableType() {
 			}
 		}
 
-		if (stateful) {
-			return new PojoSerializer<T>(clazz, duplicateFieldSerializers, fields, executionConfig);
-		} else {
-			return this;
+		if (!stateful) {
+			// as a small memory optimization, we can share the same object between instances
+			duplicateFieldSerializers = fieldSerializers;
 		}
+
+		// we must create a new instance, otherwise the subclassSerializerCache can create concurrency
problems
 
 Review comment:
   The point is that the Kryo serializer is not coming at all from the `fieldSerializers`
that we duplicate. It comes from `subclassSerializerCache` and there can be serializers as
well. But we need a new instance because it would be potentially wrong to share a cache.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message