Github user StefanRRichter commented on a diff in the pull request:

    https://github.com/apache/flink/pull/3925#discussion_r116977075
  
    --- Diff: 
flink-contrib/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/RocksDBKeyedStateBackend.java
 ---
    @@ -1116,13 +1116,27 @@ private void restoreKeyGroupsInStateHandle()
                 * @throws ClassNotFoundException
                 * @throws RocksDBException
                 */
    +           @SuppressWarnings("unchecked")
                private void restoreKVStateMetaData() throws IOException, 
ClassNotFoundException, RocksDBException {
     
                        KeyedBackendSerializationProxy serializationProxy =
                                        new 
KeyedBackendSerializationProxy(rocksDBKeyedStateBackend.userCodeClassLoader);
     
                        serializationProxy.read(currentStateHandleInView);
     
    +                   // check for key serializer compatibility; this also 
reconfigures the
    +                   // key serializer to be compatible, if it is required 
and is possible
    +                   if (StateMigrationUtil.resolveCompatibilityResult(
    +                                   serializationProxy.getKeySerializer(),
    +                                   
TypeSerializerSerializationProxy.ClassNotFoundDummyTypeSerializer.class,
    +                                   
serializationProxy.getKeySerializerConfigSnapshot(),
    +                                   (TypeSerializer) 
rocksDBKeyedStateBackend.keySerializer)
    +                           .isRequiresMigration()) {
    +
    +                           throw new RuntimeException("The new key 
serializer is not compatible to read previous keys. " +
    --- End diff --
    
    In the future, we need to be extra careful in this case. If the key's hash 
codes change through a state transformation, the their assignment to the 
operator instances is broken. Maybe we should already leave a comment about 
this here, so that we remember it in the future.


---
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.
---

Reply via email to