...
Code Block |
---|
/** * A config to define the behavior for serializer in flink job, it manages the registered type and serializers. * The config is created from job configuration and used by flink to create serializer for data type. **/ @PublicEvolving public final class SerializerConfig implements Serializable { private SerializerConfig() { } /** Create serializer config instance from configuration. */ public static SerializerConfig create(Configuration configuration) { ...; } /** Returns the registered types with their Kryo Serializer classes. */ public LinkedHashMap<Class<?>, Class<? extends Serializer<?>>> getRegisteredTypesWithKryoSerializerClasses(); /** Returns the registered Kryo Serializer classes. */ public LinkedHashMap<Class<?>, Class<? extends Serializer<?>>> getDefaultKryoSerializerClasses(); /** Returns the registered Kryo types. */ public LinkedHashSet<Class<?>> getKryoTypes(); /** Returns the registered POJO types. */ public LinkedHashSet<Class<?>> getPojoTypes(); /** Returns the registered type info factories. */ public LinkedHashMap<Class<?>, Class<TypeInfoFactory<?>>> getTypeInfoFactories(); /** * Checks whether generic types are supported. Generic types are types that go through Kryo * during serialization. * * <p>Generic types are enabled by default. * * @see #enableGenericTypes() * @see #disableGenericTypes() */ public boolean hasGenericTypesDisabled(); /** Returns whether the Apache Avro is the serializer for POJOs. */ public boolean isForceAvroEnabled(); /** Returns whether kryo is the serialzier for POJOs. */ public boolean isForceKryoEnabled(); } |
...
Also, the following nested class in ExecutionConfig
will be explicitly marked @Public
, as required by the ArchTest rule "Return and argument types of methods annotated with @PublicEvolving must be annotated with @Public(Evolving)":
Class | Annotation |
org.apache.flink.api.common.ExecutionConfig.SerializableSerializer | @Public |
Disable Kryo By Default
Currently, option pipeline.generic-types
in Flink is used to enable/disable Kryo
serialzier, its default value is true
which means Flink will use Kryo
as fallback serializer. This causes Kryo to be used by default to serialize some user-defined data without the user being aware of it, which can lead to incompatibility between the new and old versions of the job state during version upgrades. To avoid this issue, in Flink-2.0
, the default value of pipeline.generic-types
can be changed to false
to prevent the usage of the Kryo serializer without the user's knowledge.
...