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

    https://github.com/apache/flink/pull/4044#discussion_r120008474
  
    --- Diff: 
flink-runtime/src/test/java/org/apache/flink/runtime/state/StateBackendTestBase.java
 ---
    @@ -1804,53 +1805,44 @@ public void testKeyGroupSnapshotRestore() throws 
Exception {
        }
     
        @Test
    -   public void testRestoreWithWrongKeySerializer() {
    -           try {
    -                   CheckpointStreamFactory streamFactory = 
createStreamFactory();
    +   public void testRestoreWithWrongKeySerializer() throws Exception {
    +           CheckpointStreamFactory streamFactory = createStreamFactory();
     
    -                   // use an IntSerializer at first
    -                   AbstractKeyedStateBackend<Integer> backend = 
createKeyedBackend(IntSerializer.INSTANCE);
    +           // use an IntSerializer at first
    +           AbstractKeyedStateBackend<Integer> backend = 
createKeyedBackend(IntSerializer.INSTANCE);
     
    -                   ValueStateDescriptor<String> kvId = new 
ValueStateDescriptor<>("id", String.class);
    +           ValueStateDescriptor<String> kvId = new 
ValueStateDescriptor<>("id", String.class);
     
    -                   ValueState<String> state = 
backend.getPartitionedState(VoidNamespace.INSTANCE, 
VoidNamespaceSerializer.INSTANCE, kvId);
    +           ValueState<String> state = 
backend.getPartitionedState(VoidNamespace.INSTANCE, 
VoidNamespaceSerializer.INSTANCE, kvId);
     
    -                   // write some state
    -                   backend.setCurrentKey(1);
    -                   state.update("1");
    -                   backend.setCurrentKey(2);
    -                   state.update("2");
    +           // write some state
    +           backend.setCurrentKey(1);
    +           state.update("1");
    +           backend.setCurrentKey(2);
    +           state.update("2");
     
    -                   // draw a snapshot
    -                   KeyedStateHandle snapshot1 = 
FutureUtil.runIfNotDoneAndGet(backend.snapshot(682375462378L, 2, streamFactory, 
CheckpointOptions.forFullCheckpoint()));
    +           // draw a snapshot
    +           KeyedStateHandle snapshot1 = 
FutureUtil.runIfNotDoneAndGet(backend.snapshot(682375462378L, 2, streamFactory, 
CheckpointOptions.forFullCheckpoint()));
     
    -                   backend.dispose();
    +           backend.dispose();
     
    -                   // restore with the wrong key serializer
    -                   try {
    -                           restoreKeyedBackend(DoubleSerializer.INSTANCE, 
snapshot1);
    +           // restore with the wrong key serializer
    +           try {
    +                   restoreKeyedBackend(DoubleSerializer.INSTANCE, 
snapshot1);
     
    -                           fail("should recognize wrong key serializer");
    -                   } catch (RuntimeException e) {
    -                           if (!e.getMessage().contains("The new key 
serializer is not compatible")) {
    -                                   fail("wrong exception " + e);
    -                           }
    -                           // expected
    -                   }
    -           }
    -           catch (Exception e) {
    -                   e.printStackTrace();
    -                   fail(e.getMessage());
    +                   fail("should recognize wrong key serializer");
    +           } catch (StateMigrationException ignored) {
    --- End diff --
    
    This change is failing because the `RocksDBKeyedStateBackend` is not 
throwing the new exception when checking key serializers.


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