apache / apache/beam

Dataflow and KafkaIO or KinesisIO has erratic watermark progress due to ReaderCache timeouts

Open
#20,612 0 comments 0 reactions 0 assignees View on GitHub
bug dataflow P3 runners
Dominant language
Java
Stars
8.7k
Forks
4.7k
Avg merge
1d 20h
Merged PRs (30d)
196

Description

The ReaderCache has a default timeout of 1 minute. If the source is not polled within that time, the UnboundedReader is destroyed and will be reinitilized from the checkpoint when next polled. This is too short for runs where the source is not polled for a while due to other keys to process. In particular this seems to affect Streaming engine pipelines with backlog.

From an initial look, recovery from the Kafka UnboundedReader checkpoint does not seem to use the previous watermark for initializing the timestamp policy and perhaps the timestamp policy will return unknown watermark if it has not yet observed a record.

So possible fixes would be:
- make cache timeout configurable, or maybe dynamic, and increase it
- ensure that KafkaIO and KinesisIO recovery from checkpoints initializes the watermark properly so that cache eviction does not matter for watermark smoothness
- ensure that cache eviction happens in the background instead of blocking threads acquiring readers which might not expect blocking

Imported from Jira [BEAM-11366](https://issues.apache.org/jira/browse/BEAM-11366). Original Jira may contain additional context.
Reported by: scwhittle.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.