Consistency and limits
Replay safety
Every consumed source window is recorded in the engine's epoch table, keyed by the target. A retry of the same run sees the recorded window and skips the rows that were already written. The target commit and the cursor advance happen together.
A run is either fully applied or not applied at all. A failed run leaves the target at its previous committed state.
Rebuilds
A rebuild recomputes the target from the full source and publishes it as one atomic commit. It does not truncate the user-visible target first, so readers never observe an empty table during a rebuild.
A rebuild happens when:
- the query definition changes;
- the target schema changes in a way the engine cannot reconcile;
- the target has no usable state (for example, after it was dropped and recreated).
Concurrency
- Two runs against the same target are serialized by a per-target lease. The second waits or fails instead of interleaving writes.
- A data commit written by another engine in a partition the run owns is detected before the run and again before its commit; the run fails instead of silently overwriting it. Compaction commits are allowed.
- Ordinary writes to other partitions can proceed concurrently.
Partitions
A run detects the source partitions whose commits changed and reads only their new data. The target is replaced only in the partitions it owns; other target partitions are left untouched.
Retention
A run needs the source history between its cursor and the present. The Flink
NewCleanJob is cursor aware: it keeps versions from the oldest view cursor to
the present, in addition to dataExpiredTime, pinned versions and the latest
version. A view may therefore refresh less often than dataExpiredTime. Avoid
the legacy Spark CleanExpiredData / cleanOldCompaction paths on these tables;
they do not honor cursors.
If history is missing, the run fails; the next run rebuilds from the current source state.
Limits
| Limit | Behaviour |
|---|---|
| Autocommit only | Explicit transactions and multi-statement batches are refused |
INSERT ... SELECT only | INSERT ... VALUES is always a normal insert |
| Keyed sources for incremental maintenance | An insert-only append-only source can be recomputed through Tier-2 fallback; delete-bearing append-only sources are not maintained |
| Keyed target | The target needs a primary key, rowKinds, and use_cdc = true |
| Distributed execution | The IVM entry can run with distributed workers; every worker must be built with the IVM feature and the same protocol generation. The coordinator resolves source windows and commits the files workers write. |
| Supported shapes | A shape outside the list reports unsupported incremental view shape and writes nothing |
Failure modes
| Symptom | Cause |
|---|---|
source table ... has no primary key | The source is append-only; use a keyed source or enable Tier-2 fallback for insert-only data |
unsupported incremental view shape | The query shape is outside the supported list |
target table ... needs the internal rowKinds/__ivm_epoch columns | The target is missing rowKinds (or the engine could not add the epoch column) |
target table ... needs a primary key | The target is not a keyed table |
| A concurrent-writer error | Another engine wrote the target scope during the run; retry |