Github user uce commented on a diff in the pull request: https://github.com/apache/flink/pull/2584#discussion_r82216509 --- Diff: flink-runtime/src/main/java/org/apache/flink/runtime/state/heap/HeapKeyedStateBackend.java --- @@ -259,28 +263,29 @@ public void restorePartitionedState(List<KeyGroupsStateHandle> state) throws Exc try { - fsDataInputStream = keyGroupsHandle.getStateHandle().openInputStream(); + fsDataInputStream = keyGroupsHandle.openInputStream(); cancelStreamRegistry.registerClosable(fsDataInputStream); DataInputViewStreamWrapper inView = new DataInputViewStreamWrapper(fsDataInputStream); int numKvStates = inView.readShort(); - Map<Integer, String> kvStatesById = new HashMap<>(numKvStates); - for (int i = 0; i < numKvStates; ++i) { String stateName = inView.readUTF(); - TypeSerializer namespaceSerializer = + TypeSerializer<?> namespaceSerializer = InstantiationUtil.deserializeObject(fsDataInputStream, userCodeClassLoader); - TypeSerializer stateSerializer = + TypeSerializer<?> stateSerializer = InstantiationUtil.deserializeObject(fsDataInputStream, userCodeClassLoader); - StateTable<K, ?, ?> stateTable = new StateTable(stateSerializer, - namespaceSerializer, - keyGroupRange); - stateTables.put(stateName, stateTable); - kvStatesById.put(i, stateName); + StateTable<K, ?, ?> stateTable = stateTables.get(stateName); + + if (null == stateTable) { --- End diff -- Let's add a comment here that it is important to check for previously restored state first.
--- 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. ---