Skip to main content

route_cdc_chunk

Function route_cdc_chunk 

Source
fn route_cdc_chunk(
    chunk: StreamChunk,
    splits: &[CdcTableSnapshotSplit],
    states: &[CdcStateRecord],
    current_split_idx: usize,
    snapshot_split_column_index: usize,
) -> (Option<StreamChunk>, Option<StreamChunk>)
Expand description

Splits CDC rows into chunks to forward immediately or buffer for replay. Returns None for either result when it contains no rows.

Rows in the active split are always buffered because later snapshot rows may overwrite them.

Rows in inactive splits are routed according to their durable snapshot progress:

  • not started: discard, because a future snapshot will observe the latest state;
  • finished: forward, because no future snapshot will cover the change;
  • partially written: forward, because some rows may already exist downstream and, without a cursor, we cannot determine which side of the durable snapshot progress contains this row.