Add skip_cagg_invalidation GUC for bulk loads (#9842)
commit feffda0 ↗ · timescale/timescaledb · · committed May 22, 2026 · +699−22 · base a058defa17f8
Agent prompt
what a new run launched now would send
Bulk-migration tools copy both hypertable data and continuous-aggregate materializations onto a target. After 2.23.0, cagg invalidation runs in the executor (the old invalidation trigger is gone), so those bulk INSERT/COPY/DDL operations still write invalidation log entries and force unnecessary re-materialization of ranges that are already consistent.
Existing workarounds are inadequate: writing chunks directly still records invalidations; `timescaledb.restoring=on` breaks routing; clearing the invalidation log after the load races with concurrent writers.
Add a supported, non-destructive, session/transaction-scoped opt-out so tools that own the refresh lifecycle can suppress continuous-aggregate invalidation tracking for the duration of a bulk load.
Acceptance criteria a teammate would know upfront:
- Default remains off: normal DML still records hypertable invalidations.
- When enabled via SET LOCAL inside a transaction, INSERT/UPDATE/DELETE/COPY on hypertables with caggs (including direct chunk writes and direct-compress INSERT/COPY) must not append invalidation log entries.
- The same opt-out must cover DDL that would otherwise invalidate: drop_chunks, DROP TABLE on a chunk, TRUNCATE chunk, TRUNCATE hypertable, TRUNCATE continuous aggregate (including hierarchical cagg cascade).
- SET LOCAL must not leak across COMMIT; subsequent DML with the setting off must record invalidations again.
- After a skipped bulk load, an explicit `refresh_continuous_aggregate(..., force => true)` must still materialize the new data.
- Misuse may leave caggs stale; that is acceptable—callers own refresh.
Interface contract — the change must expose exactly this surface:
Expose a PGC_USERSET boolean GUC named `timescaledb.skip_cagg_invalidation` (default off), usable with `SET LOCAL timescaledb.skip_cagg_invalidation = on`.
Work only inside this repository checkout. Make the code change the task
describes, keeping the diff focused — no drive-by refactors.
When you are done, leave your changes committed or in the working tree;
they are collected automatically.
Stay on this snapshot checkout (`task/ycb_timescaledb_cfeffda04ea96`). Never checkout, pull, or rebase onto `main`. That branch is a README-only orphan.
Stay on this HEAD. Do not fetch another default branch. Push only on the Cursor-created `crazy-cursor/…` side branch from this HEAD.
Some past runs of this task were launched with a different prompt (the prompt template changed since, or those runs predate this benchmark's stored prompt). Each run persists the exact prompt it sent at launch — that per-launch record is the audit trail; this page shows only the current one.
Reference diff
The task commit's diff against its first parent — the judge's comparison target.