Github user tzulitai commented on a diff in the pull request:
https://github.com/apache/flink/pull/5337#discussion_r163175349
--- Diff:
flink-connectors/flink-connector-kinesis/src/main/java/org/apache/flink/streaming/connectors/kinesis/FlinkKinesisConsumer.java
---
@@ -267,6 +269,27 @@ public void run(SourceContext<T> sourceContext) throws
Exception {
sourceContext.close();
}
+ /**
+ * Tries to find the {@link SequenceNumber} for a given {@code
kinesisStreamShard} in the list of the restored stream shards' metadata,
+ * by comparing the stream name and shard id for equality.
+ * @param current the current Kinesis
shard we're trying to find the restored sequence number for
+ * @param sequenceNumsToRestore the restored sequence numbers
+ * @return the sequence number, if any, or {@code null} if no matching
shard is found
+ */
+ @VisibleForTesting
+ SequenceNumber findSequenceNumberToRestoreFrom(StreamShardMetadata
current, HashMap<StreamShardMetadata, SequenceNumber> sequenceNumsToRestore) {
+ checkNotNull(current.getStreamName(), "Stream name not set on
the current metadata shard");
+ checkNotNull(current.getShardId(), "Shard id not set on the
current metadata shard");
+
+ for (final Map.Entry<StreamShardMetadata, SequenceNumber> entry
: sequenceNumsToRestore.entrySet()) {
--- End diff --
The `final` is redundant here.
---