apache / apache/beam

Overlapping sessions with zero allowed lateness due to window expiry rules

Open
#18,677 0 comments 0 reactions 0 assignees View on GitHub
beam-model bug core P3 runners
Dominant language
Java
Stars
8.7k
Forks
4.7k
Avg merge
2d 2h
Merged PRs (30d)
205

Description

Consider this sequence, with session gap durations of 5:

- element arrives with timestamp 0, assigned to proto-window [0, 5)
- watermark advances to 6, emitting the session and discarding it
- element arrives with timestamp 3, assigned to proto-window [3, 8) so it is not dropped as the window is not expired
- watermark advances to 8****, emitting that session

While "technically correct" according to spec, this seems undesirable. It was introduced when late data dropping was tied to window expiry. I think either dropping the second element or including it and emitting a merged window would be OK.

In the case of sessions, we could just retain the window until it cannot possibly merge with other non-expired data. Even with allowed lateness zero this is double the gap duration. The window would be in an interesting state where it would be expired and ineligible for further output but could still merge and the greater window could be output.

The challenge is that sessions are just one kind of merging window - the merging logic has to be assumed opaque. So we cannot simply reason about how sessions work. The other, more drastic option, is to rethink how late data dropping is defined for merging windows, particularly in the "proto-window" phase.

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

Contributor guide

Open the contributing guide

Research direction

Start with the original Jira BEAM-3568 and trace the merging-window and proto-window behavior described here. Determine how zero allowed lateness should handle the overlapping session sequence, then define and test a consistent late-data rule for merging windows; the issue does not identify specific files or tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
stream-processing
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.