Unit 14 of 15 · about 5 hours · implement

An event-time processor with checkpoints

This is where the section's ideas meet: event-time windows, watermarks with a late-data policy, and checkpoint barriers, in one bounded processor that survives a kill.

You'll be able to

  • Implement tumbling or session windows over event time with an explicit watermark, trigger and accumulation mode.
  • Implement checkpoint of offsets plus state with restore that reproduces matching outputs on replay, including one late event.

Covers

Event-time processor and checkpoint implementation
1

Read

In this order, only the parts listed

0 of 3 done

  1. Checkpoint configuration for the buildApache Flink 2.3 - Event Time, State and Checkpointing

    Enabling and Configuring Checkpointing: interval, exactly-once versus at-least-once mode, checkpoint storage

  2. One trigger and one accumulation modeThe Dataflow Model (Akidau et al., 2015)

    Section 2: windows, triggers and accumulation. Implement one trigger and one accumulation mode, not the catalog.

  3. Idle sources in the buildApache Flink 2.3 - Event Time, State and Checkpointing

    Dealing With Idle Sources with .withIdleness: declare idle inputs so one quiet partition cannot stall the processor

2

Focus on

  • Checkpoint operator state and source offsets together. Restoring one without the other loses or duplicates.
  • One trigger decides when a window fires; one accumulation mode decides what a correction does. Implement both explicitly instead of inheriting framework defaults.
  • Bound the state: expire windows and dedup keys by watermark plus allowed lateness, and count what the horizon drops.
  • Keep sinks inside the checkpoint boundary or behind an idempotent key. A sink outside it repeats on recovery.
Common mistakes · 3
  • Checkpointing state but not offsets. Restore then replays from the wrong position.
  • Firing windows on processing time in tests. Deterministic tests advance event time and watermarks by hand.
  • Growing window state without expiry. Every window needs a close rule tied to watermark plus lateness.
3

Try it yourself

Closed-book, before checking anything

From a blank file, build the bounded processor, kill it mid-window, restore from the last checkpoint and show identical window outputs for a fixed event history with one late event.
4

Quiz yourself

Answer first, then mark it. Missed ones go to Review.

0 got · 0 missed

  1. 1.State is checkpointed but source offsets are not. What happens after restore?Answer

    Sources replay from the wrong position: already-applied inputs apply again or unapplied inputs are skipped, depending on where reading resumes.

  2. 2.What does the trigger decide and what does the accumulation mode decide?Answer

    The trigger decides when a window fires. The accumulation mode decides what a correction does to prior output: ignore, accumulate or retract.

  3. 3.A late event arrives past the horizon under the update policy with expired state. What is the correct output?Answer

    No correction. Expired state is gone, so the event is counted as dropped-late; updating would need state that no longer exists.

  4. 4.How is the kill test deterministic?Answer

    A fixed event history with scripted watermarks and a scripted kill point, asserting identical outputs before and after restore.

5

Practice

  • AlgoMaster: Assign Events to Session Windows

    Per-user sessions with the gap-reaches-threshold rule; interleaved users stay independent

    Drill the session assignment the processor needs, on a subscription the learner owns. The section mini-project covers the processor with checkpoints, watermarks and kill tests.

You're done when

The processor reproduces identical window outputs across a mid-window kill for a fixed history with retries, one late event and one idle input.

Only when you can do this without notes.

Leads to

Notes

Resources · 2 for this unit, 16 more in the section
  • The Dataflow Model (Akidau et al., 2015)Google (author copy) · required

    Read the model section: event time versus processing time, windowing, triggers and accumulation. Implement one trigger and one accumulation mode, not the catalog.

  • Apache Flink 2.3 - Event Time, State and CheckpointingApache Flink · required

    Read the 2.3 concepts pages on time (event time, watermarks, lateness, windowing) and stateful stream processing (keyed state, checkpoint barriers, recovery, unaligned checkpoints, exactly-once versus at-least-once), then the watermark-generation guide on idle sources. Use them to build one bounded local processor; exactly-once covers state and participating sinks only.

Also in this section