#26481·risingwave

Tracking: CDC table RESNAPSHOT support

Author: hzxa21Created Jul 28, 2026Updated Sep 27, 2026
Labelsno-issue-activity

Motivation

A CDC table can diverge from its upstream table when WAL/binlog history is no longer available or an operational recovery intentionally starts from a new CDC position. Recreating the CDC table repairs the data, but is expensive and disruptive for users.

ALTER TABLE ... RESNAPSHOT should repair an existing CDC table online. It should detect missing rows, stale rows, and rows that should be deleted while allowing new upstream changes to continue flowing.

High-level design

At the start of a RESNAPSHOT, RisingWave pins a committed view of the existing CDC table and reads a fresh upstream snapshot. Both sides are scanned in primary-key order and merged to produce corrections:

  • Insert rows that exist only upstream.
  • Delete rows that exist only in RisingWave.
  • Upsert rows whose values differ.
  • Skip equal rows.

Concurrent CDC events are coordinated with snapshot progress so that, for each key, the snapshot diff is applied before newer WAL/binlog events. Progress, offsets, and the active generation are checkpointed so the operation can recover or reschedule safely. Parallel backfill uses disjoint key ranges that together cover the complete key space.

The PostgreSQL/RisingWave primary-key ordering contract is provided by #26444 and is a prerequisite for the RESNAPSHOT stack.

Proposed PR stack

  • Ordered diff reader

    • Add the streaming ordered merge diff and snapshot progress semantics.
    • Read the existing RisingWave table at a pinned committed epoch.
  • Plan and catalog state

    • Make the CDC table state available to the diff reader.
    • Add the internal state required by recoverable parallel backfill.
  • Recoverable CDC backfill buffering

    • Checkpoint buffered CDC events and offsets safely.
    • Preserve correctness across throttling, pause, retry, and recovery.
  • RESNAPSHOT compute runtime

    • Integrate the diff reader with non-parallel and parallel CDC backfill.
    • Report generation-aware progress and completion.
  • Meta orchestration and durability

    • Validate prerequisites and start RESNAPSHOT at a committed epoch.
    • Persist lifecycle state and handle completion, recovery, reschedule, and rolling upgrades safely.
  • ALTER TABLE ... RESNAPSHOT

    • Add the SQL, frontend, and RPC surface.
    • Add end-to-end coverage for online repair and recovery.
  • Observability and documentation

    • Add operational metrics and user-facing documentation.

Each PR should remain independently buildable and testable. The SQL surface is the final activation layer after the runtime and durability guarantees are in place.

Source: risingwavelabs/risingwave