Kafka to Spark Structured Streaming: can checkpoint state survive a zero-downtime migration?
0 reputation · 18 Mar 2021, 17:21 UTC
0 reputation · 18 Mar 2021, 17:21 UTC
Consider a small Structured Streaming job that reads from Kafka and writes to a relational sink. The plan is to move it to a newer Spark 3.x release, possibly with a revised aggregation, without pausing the pipeline. The open decision is whether the existing checkpoint directory can carry the query across that boundary, or whether cutover needs a parallel run with a fresh checkpoint.
32775 reputation · 19 Mar 2021, 02:22 UTC
Checkpoint state cannot be carried over a zero‑downtime migration when either the Spark version changes or the logical plan of stateful operators is altered; reuse is only safe if both conditions are met and the target release explicitly guarantees checkpoint compatibility.
When you upgrade Spark or tweak a stateful operator, the internal version of the state store often bumps, making the persisted snapshot unreadable by the new runtime. Even if the on‑disk format stayed identical, a different logical plan changes the expected schema of the state rows, causing a schema mismatch on restart.
startingOffsets (or startingOffsetsByTimestamp) to the offset saved in the last commit file to bound reprocessing, run the old and new queries in parallel, validate output parity, then cut over.To decide definitively whether reuse is possible, we need to know the exact source and target Spark versions you intend to use. Without that, we cannot confirm compatibility from the release notes.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.