dawidwys commented on a change in pull request #6711: [FLINK-9377] [core, state 
backends] Remove serializers from checkpoints
URL: https://github.com/apache/flink/pull/6711#discussion_r223315346
 
 

 ##########
 File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/state/KeyedBackendSerializationProxy.java
 ##########
 @@ -139,23 +150,30 @@ public void read(DataInputView in) throws IOException {
                }
 
                // only starting from version 3, we have the key serializer and 
its config snapshot written
-               if (readVersion >= 3) {
-                       Tuple2<TypeSerializer<?>, TypeSerializerConfigSnapshot> 
keySerializerAndConfig =
+               if (readVersion >= 6) {
+                       this.keySerializerConfigSnapshot = 
TypeSerializerSnapshotSerializationUtil.readSerializerSnapshot(
+                               in, userCodeClassLoader, null);
+               } else if (readVersion >= 3) {
+                       Tuple2<TypeSerializer<?>, TypeSerializerSnapshot<?>> 
keySerializerAndConfig =
                                        
TypeSerializerSerializationUtil.readSerializersAndConfigsWithResilience(in, 
userCodeClassLoader).get(0);
-                       this.keySerializer = (TypeSerializer<K>) 
keySerializerAndConfig.f0;
-                       this.keySerializerConfigSnapshot = 
keySerializerAndConfig.f1;
+                       this.keySerializerConfigSnapshot = 
(TypeSerializerSnapshot<K>) keySerializerAndConfig.f1;
                } else {
-                       this.keySerializer = 
TypeSerializerSerializationUtil.tryReadSerializer(in, userCodeClassLoader, 
true);
-                       this.keySerializerConfigSnapshot = null;
+                       this.keySerializerConfigSnapshot = new 
BackwardsCompatibleSerializerSnapshot<>(
+                               
TypeSerializerSerializationUtil.tryReadSerializer(in, userCodeClassLoader, 
true));
                }
+               this.keySerializer = null;
 
                if (isSerializerPresenceRequired) {
-                       checkSerializerPresence(keySerializer);
+                       
checkSerializerPresence(this.keySerializerConfigSnapshot.restoreSerializer());
                }
 
-               int metaInfoVersion = readVersion > 4 ? 
CURRENT_STATE_META_INFO_SNAPSHOT_VERSION : readVersion;
+               Integer metaInfoSnapshotVersion = 
META_INFO_SNAPSHOT_FORMAT_VERSION_MAPPER.get(readVersion);
 
 Review comment:
   Can't we just use the readVersion?

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to