Skip to main content

retire_partitions

Function retire_partitions 

Source
pub async fn retire_partitions(
    transaction: &mut Transaction<'_, Postgres>,
    view_set_name: &str,
    view_instance_id: &str,
    begin_insert_time: DateTime<Utc>,
    end_insert_time: DateTime<Utc>,
    retire_match: RetireMatch,
    same_run_ranges: &[TimeRange],
    logger: Arc<dyn Logger>,
) -> Result<(), Error>
Expand description

Retires partitions from the active set.

retire_match selects the SQL predicate (see RetireMatch): Containment is an insert-range containment test on the existing partition (with an exact-match special case for a degenerate new range), correct whenever a view’s cut points are stable across runs. Overlap additionally matches (and retires) an existing partition that merely overlaps the new range without containing it, which BlockOrder::EventTime JIT views need because their cut points can move between runs.

same_run_ranges lists the exact (begin_insert_time, end_insert_time) pairs the calling jit_update run has already written (or found already up to date) earlier in its own loop; a row matching one of these pairs is never retired, even when the retire_match predicate would otherwise match it (see RetireMatch::Overlap’s docs for why this is identity-, not shape-, based). Only meaningful for RetireMatch::Overlap – pass &[] for Containment.