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

    https://github.com/apache/flink/pull/3001#discussion_r92555340
  
    --- Diff: 
flink-connectors/flink-connector-kinesis/src/main/java/org/apache/flink/streaming/connectors/kinesis/FlinkKinesisConsumer.java
 ---
    @@ -294,11 +296,18 @@ public void close() throws Exception {
                                lastStateSnapshot.toString(), checkpointId, 
checkpointTimestamp);
                }
     
    -           return lastStateSnapshot;
    +           List<Tuple2<KinesisStreamShard, SequenceNumber>> listState = 
new ArrayList<>(lastStateSnapshot.size());
    +           for (Map.Entry<KinesisStreamShard, SequenceNumber> entry: 
lastStateSnapshot.entrySet()) {
    +                   listState.add(Tuple2.of(entry.getKey(), 
entry.getValue()));
    +           }
    +           return listState;
        }
     
        @Override
    -   public void restoreState(HashMap<KinesisStreamShard, SequenceNumber> 
restoredState) throws Exception {
    -           sequenceNumsToRestore = restoredState;
    +   public void restoreState(List<Tuple2<KinesisStreamShard, 
SequenceNumber>> state) throws Exception {
    +           sequenceNumsToRestore = new HashMap<>();
    +           for (Tuple2<KinesisStreamShard, SequenceNumber> subState: 
state) {
    --- End diff --
    
    We should probably do a null check here for `state`.
    From the looks of #3005, I don't think restored state will ever be null 
(will be empty list), but it'd be good to make the code here independent of 
that.


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

Reply via email to