Windowing & Watermarks concept page. Streaming pipeline: Kafka source feeds a Flink job (Watermark Assigner -> keyBy -> Window Operator -> RocksDB state). Window emissions go to an aggregates sink, late events go to a side-output sink. Four scenarios: tumbling 1m window aggregation, late event with allowedLateness=2m re-fires window, session window with gap=15min for user activity, plus an ADR contrasting event-time + watermark vs processing-time simplicity.
Window отвечает «где группировать event time», trigger — «когда emit», watermark — estimate input completeness, accumulation — «как update result». Смешивать эти четыре решения опасно.
| Компонент | Ответственность |
|---|---|
| Active Partition A | Поставляет events and a local event-time watermark. |
| Late Partition B | Медленнее продвигает watermark and sends out-of-order events. |
| Idle Partition C | Не генерирует events; требует explicit idleness detection. |
| Watermark Coordinator | Комбинирует active input watermarks; не предсказывает невозможность late data. |
| Window State | Хранит keyed aggregates/events through allowed lateness. |
| Versioned Result Sink | Поддерживает upsert/retraction или explicit append revisions. |
| Too-Late Reconciliation | Принимает events after cleanup cutoff. |
Events with timestamps in [10
,10) update the keyed window. When the effective watermark passes 10, the initial trigger emits a result but retains state for allowed lateness.Проверяемый исход: Initial output is version 1, not irreversible final truth.
An event for the already-fired window arrives before the cleanup deadline. State still exists, so the aggregate changes and emits version 2/retraction.
Проверяемый исход: The sink deterministically replaces or revises v1; state was not deleted on first fire.
A min-style watermark stalls if one partition emits neither records nor watermarks. After a configured idleness timeout, the partition is excluded until it resumes, then late events follow policy.
Проверяемый исход: Idleness is an operational assumption, not evidence the source has no more old data.
After watermark plus allowed lateness, window state is cleaned. A later event cannot be merged locally and is routed with reason/provenance for reconciliation.
Проверяемый исход: No silent discard and no false replay determinism promise when external/reference inputs changed.
Числа выше — учебные inputs или размерностные формулы. Их нельзя выдавать за benchmark или SLA конкретного продукта.
Диаграмма показывает причинные границы и recovery contracts, а не скрытую реализацию конкретного managed-сервиса. Любая stronger guarantee действует только в явно названной transaction/checkpoint/acknowledgement boundary.
Введите числа или выберите пресет