Hey guys, I noticed that Flink doesn’t acknowledge...
# troubleshooting
m
Hey guys, I noticed that Flink doesn’t acknowledge processed records from Kinesis. Does anyone know what could be missing? I’m simply taking those events and writing them to local parquet files. Every time I cancel and start the same job, I see those same records again.
m
Have you enabled checkpointing?
m
yes
I’m reading from TRIM_HORIZON and to my understanding, acked records should be removed. Is that correct?
m
That I don't know 😄 but checkpointing is the first/only thing I would flag on this
m
I even turned on RETAIN_ON_CANCELLATION but I see a different folder created in the checkpoints directory for every job once I cancel and start a new one
a
No, Kinesis stream is not aware of records consumers read from it. It uses iterator to select position to read from. Are you starting your job from savepoint after cancellation?
m
no
but Kinesis is aware of checkpointed records for each application, isn’t that right? So even without a savepoint the job should read what it didn’t consume?
a
Checkpoint exists for Flink, Kinesis is not aware of it. When you restore from checkpoint/savepoint connector reads iterators persisted in source state and reads records starting from positions on the time of checkpointing,
m
but Kinesis has it’s own checkpoints stored on DynamoDB
@Aleksandr Pilipenko If Kinesis is not aware of what was acknowledged, it simply retains records according to the retention period?
In that case, should savepoints be kept indefinitely?
a
yes
m
I think I got it. Once I cancel a job I should resume from the savepoint, and if I do that again, I can remove the previous savepoints?
a
but Kinesis has it’s own checkpoints stored on DynamoDB
I think you talking about Kinesis Client Library: https://docs.aws.amazon.com/streams/latest/dev/shared-throughput-kcl-consumers.html#shared-throughput-kcl-consumers-concepts
m
yes. I couldn’t figure out if the consumer for flink is based on it or not
a
I think I got it. Once I cancel a job I should resume from the savepoint, and if I do that again, I can remove the previous savepoints?
correct, you only need latest savepoint unless you need to reprocess older records
I couldn’t figure out if the consumer for flink is based on it or not
No, consumer uses Kinesis API
m
thank you. That was very helpful! I assumed Flink is making Kinesis know which records it consumed. So the best practice is to consume from TRIM_HORIZON and use savepoints?
the default is LATEST I suppose
a
Using TRIM_HORIZON or LATEST depends on your usecase: whether you need to process data from before application was started or not. But if you need to be able to start app from the position you left of - you need to use savepoints.
m
thanks a lot man
a
you’re welcome
m
last question if it’s okay, being implemented with AWS SDK, the consumer lack the ability to aggregate and de-aggregate multiple records on its own. I understand that the connector can pull a single record at a time (from the implementation perspective) so it means that I will hit Kinesis limits faster with the same amount of shards. Is there a workaround for Flink around that?
d
Source supports de-aggregation (it actually has a dependency on KCL just to use the de-aggregation code).
FlinkKinesisProducer
is based on KPL and support aggregation.
KinesisStreamsSink
is native AWS SDK implementation and does not support aggregation
👍 1
m
what about
FlinkKinesisConsumer
?
I’m using Flink as a consumer only
a
FlinkKinesisConsumer is a Kinesis source and, as Danny pointed out, supports de-aggregation.
m
thank you Danny and Aleksandr!