Github user StefanRRichter commented on a diff in the pull request:
https://github.com/apache/flink/pull/3937#discussion_r117710279
--- Diff:
flink-core/src/main/java/org/apache/flink/api/common/typeutils/CompositeTypeSerializerConfigSnapshot.java
---
@@ -19,47 +19,65 @@
package org.apache.flink.api.common.typeutils;
import org.apache.flink.annotation.Internal;
+import org.apache.flink.api.java.tuple.Tuple2;
import org.apache.flink.core.memory.DataInputView;
import org.apache.flink.core.memory.DataOutputView;
import org.apache.flink.util.Preconditions;
import java.io.IOException;
-import java.util.Arrays;
+import java.util.ArrayList;
+import java.util.List;
/**
* A {@link TypeSerializerConfigSnapshot} for serializers that has
multiple nested serializers.
- * The configuration snapshot consists of the configuration snapshots of
all nested serializers.
+ * The configuration snapshot consists of the configuration snapshots of
all nested serializers, and
+ * also the nested serializers themselves.
+ *
+ * <p>Both the nested serializers and the configuration snapshots are
written as configuration of
+ * composite serializers, so that on restore, the previous serializer may
be used in case migration
+ * is required.
*/
@Internal
public abstract class CompositeTypeSerializerConfigSnapshot extends
TypeSerializerConfigSnapshot {
- private TypeSerializerConfigSnapshot[] nestedSerializerConfigSnapshots;
+ private List<Tuple2<TypeSerializer<?>, TypeSerializerConfigSnapshot>>
nestedSerializersWithConfigs;
/** This empty nullary constructor is required for deserializing the
configuration. */
public CompositeTypeSerializerConfigSnapshot() {}
- public
CompositeTypeSerializerConfigSnapshot(TypeSerializerConfigSnapshot...
nestedSerializerConfigSnapshots) {
- this.nestedSerializerConfigSnapshots =
Preconditions.checkNotNull(nestedSerializerConfigSnapshots);
+ public CompositeTypeSerializerConfigSnapshot(TypeSerializer<?>...
nestedSerializers) {
+ Preconditions.checkNotNull(nestedSerializers);
+
+ this.nestedSerializersWithConfigs = new
ArrayList<>(nestedSerializers.length);
+ TypeSerializerConfigSnapshot configSnapshot;
--- End diff --
I think this could go inside the loop.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---