tzulitai commented on a change in pull request #6875: [FLINK-9808] [state backends] Migrate state when necessary in state backends URL: https://github.com/apache/flink/pull/6875#discussion_r227668423
########## File path: flink-runtime/src/main/java/org/apache/flink/runtime/state/heap/HeapKeyedStateBackend.java ########## @@ -269,22 +276,20 @@ public HeapKeyedStateBackend( "Requested to check compatibility of a restored RegisteredKeyedBackendStateMetaInfo," + " but its corresponding restored snapshot cannot be found."); - newMetaInfo = new RegisteredKeyValueStateBackendMetaInfo<>( - stateDesc.getType(), - stateDesc.getName(), - namespaceSerializer, - stateDesc.getSerializer(), - snapshotTransformer); + CompatibilityResult<N> namespaceCompatibility = CompatibilityUtil.resolveCompatibilityResult( + restoredMetaInfoSnapshot.getTypeSerializer(StateMetaInfoSnapshot.CommonSerializerKeys.NAMESPACE_SERIALIZER.toString()), + null, + restoredMetaInfoSnapshot.getTypeSerializerConfigSnapshot(StateMetaInfoSnapshot.CommonSerializerKeys.NAMESPACE_SERIALIZER.toString()), + namespaceSerializer); + + CompatibilityResult<V> stateCompatibility = + RegisteredKeyValueStateBackendMetaInfo.resolveStateCompatibiliity(restoredMetaInfoSnapshot, stateDesc, newStateSerializer); + + // TODO: here we need to check if the namespace / state compatibility results are incompatible; + // TODO: this can't be done here because the old CompatibilityResult class does not reflect this Review comment: This TODO is the reason why the following tests are failing: ``` Failed tests: PojoSerializerUpgradeTest.testAdditionalFieldWithKeyedState:234 Expected a state migration exception. PojoSerializerUpgradeTest.testAdditionalFieldWithKeyedState:234 Expected a state migration exception. PojoSerializerUpgradeTest.testChangedFieldTypesWithKeyedState:200 Expected a state migration exception. PojoSerializerUpgradeTest.testChangedFieldTypesWithKeyedState:200 Expected a state migration exception. PojoSerializerUpgradeTest.testMissingFieldWithKeyedState:268 Expected a state migration exception. PojoSerializerUpgradeTest.testMissingFieldWithKeyedState:268 Expected a state migration exception. ``` ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services