Skip to main content

compute_repairs

Function compute_repairs 

Source
pub(crate) fn compute_repairs(
    snapshot: &[(StateUpdateKindJson, Timestamp, Diff)],
) -> (Vec<(StateUpdateKindJson, Diff)>, RepairStats)
Expand description

Inspect a consolidated snapshot and return the updates needed to converge every affected Role onto a single live +1 (or zero rows, for the dropped case).

The returned Vec is safe to feed straight into compare_and_append. For each repair site we emit:

  • +1 of the dangling row (cancels the existing -1);
  • one -1 per stale +1 row whose parsed value equals the dangling row’s (completes the retraction the original DDL was supposed to perform).

Separated from upgrade so it can be unit-tested without spinning up a real catalog handle.