You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2021/02/08 19:39:42 UTC
[GitHub] [flink] mproch commented on a change in pull request #14902: [FLINK-21138][queryableState] - User ClassLoader in KvStateServerHandler
mproch commented on a change in pull request #14902:
URL: https://github.com/apache/flink/pull/14902#discussion_r572318563
##########
File path: flink-queryable-state/flink-queryable-state-runtime/src/test/java/org/apache/flink/queryablestate/itcases/AbstractQueryableStateTestBase.java
##########
@@ -361,6 +372,65 @@ public Integer getKey(Tuple2<Integer, Long> value) {
}
}
+ /** This test checks if custom Kryo serializers are loaded with correct classloader. */
+ @Test
+ public void testCustomKryoSerializerHandling() throws Exception {
+ final Deadline deadline = Deadline.now().plus(TEST_TIMEOUT);
+ final long numElements = 1;
+ final String stateName = "teriberka";
+
+ final String customSerializerClassName = "CustomKryo";
+ final URLClassLoader userClassLoader =
+ createLoaderWithCustomKryoSerializer(customSerializerClassName);
+
+ StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
+ env.setStateBackend(stateBackend);
+ env.setParallelism(maxParallelism);
+ // Very important, because cluster is shared between tests and we
+ // don't explicitly check that all slots are available before
+ // submitting.
+ env.setRestartStrategy(RestartStrategies.fixedDelayRestart(Integer.MAX_VALUE, 1000L));
+
+ // Custom serializer is not needed, it's used just to check if serialization works.
+ @SuppressWarnings("unchecked")
+ Class<Serializer<?>> customSerializerClass =
+ (Class<Serializer<?>>) userClassLoader.loadClass(customSerializerClassName);
+ env.getConfig().addDefaultKryoSerializer(Byte.class, customSerializerClass);
Review comment:
You're right, thanks for spotting this, I think I made one cleanup too much :)
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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