[ 
https://issues.apache.org/jira/browse/FLINK-6803?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16036282#comment-16036282
 ] 

ASF GitHub Bot commented on FLINK-6803:
---------------------------------------

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.


> Add test for PojoSerializer when Pojo changes
> ---------------------------------------------
>
>                 Key: FLINK-6803
>                 URL: https://issues.apache.org/jira/browse/FLINK-6803
>             Project: Flink
>          Issue Type: Improvement
>          Components: Type Serialization System
>    Affects Versions: 1.4.0
>            Reporter: Till Rohrmann
>            Assignee: Till Rohrmann
>
> We should add test cases for the {{PojoSerializer}} when the underlying Pojo 
> type changes in order to test the proper behaviour of the serializer.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to