Skip to main content

apply_replacement_mvs

Function apply_replacement_mvs 

Source
async fn apply_replacement_mvs(
    client: &Client,
    plan: &DeploymentPlan,
) -> Result<(), CliError>
Expand description

Apply replacement materialized views using data from the plan.

Uses plan.replacement_mvs instead of re-querying.

Idempotent across a post-swap resume: APPLY REPLACEMENT consumes the staging MV, and the replacement-MV records are not deleted until cleanup_apply_state. A crash between recording the promotion and that cleanup leaves the records in place while their staging MVs are already gone, so re-running skips any replacement whose staging source MV no longer exists rather than erroring on the dropped staging schema.