tzulitai commented on a change in pull request #8565: [FLINK-11947] Support 
MapState value schema evolution for RocksDB
URL: https://github.com/apache/flink/pull/8565#discussion_r289757845
 
 

 ##########
 File path: 
flink-state-backends/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/RocksDBKeyedStateBackend.java
 ##########
 @@ -538,13 +539,19 @@ public void notifyCheckpointComplete(long 
completedCheckpointId) throws Exceptio
         * the key here, which is made up of key group, key, namespace and map 
key
         * (in case of MapState).
         */
+       @SuppressWarnings("unchecked")
        private <N, S extends State, SV> void migrateStateValues(
                StateDescriptor<S, SV> stateDesc,
                Tuple2<ColumnFamilyHandle, 
RegisteredKeyValueStateBackendMetaInfo<N, SV>> stateMetaInfo) throws Exception {
 
                if (stateDesc.getType() == StateDescriptor.Type.MAP) {
-                       throw new StateMigrationException("The new serializer 
for a MapState requires state migration in order for the job to proceed." +
-                               " However, migration for MapState currently 
isn't supported.");
+                       TypeSerializer priorUserKeySerializer = 
((MapSerializer) 
stateMetaInfo.f1.getPreviousStateSerializer()).getKeySerializer();
+                       TypeSerializer newUserKeySerializer = ((MapSerializer) 
stateMetaInfo.f1.getStateSerializer()).getKeySerializer();
+                       TypeSerializerSchemaCompatibility compatibility = 
priorUserKeySerializer.snapshotConfiguration().resolveSchemaCompatibility(newUserKeySerializer);
 
 Review comment:
   This seems to be incorrect.
   You should be able to get the snapshot of the prior user key serializer in 
the restored meta info snapshots map.
   You do not need extra work in creating a new serializer snapshot just for 
the purpose of performing a compatibility check.

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


With regards,
Apache Git Services

Reply via email to