Skip to content

Darling compose: CAGG routing has no rollup-availability gate — old-window custom-view panels throw 42P01 on plain-PostgreSQL stores #1665

Closed

Description

@erikdarlingdata

Pre-existing sibling of the #1664 fix, shipped with the original compose read-routing (#1625-#1627).

Problem

ComposeSourceRouter.Resolve routes a custom-view panel to collect.query_stats_hourly / procedure_stats_hourly / query_store_stats_hourly (or the _daily tiers) purely by the window's age and the CAGG catalog's dimension coverage. It never checks whether the rollup exists in the store. The continuous aggregates are runtime TimescaleDB setup (TimescaleSupport.EnsureContinuousAggregatesAsync), so:

  • a bring-your-own plain PostgreSQL store never has them → any composed panel whose window starts more than ~3 days back compiles SQL against a missing relation and fails at run time with 42P01;
  • a TimescaleDB store whose failure-isolated ensure sweep only built some aggregates routes onto the missing ones the same way.

The built-in tabs got an availability gate in #1664 (TimescaleSupport.DetectRollupsAsync + RetentionTierRouter.Resolve(now, start, hourlyAvailable, dailyAvailable)); the composer still routes blind.

Why it's not a one-liner

The composer's catalog spans three tables' rollup pairs (ComposeCaggCatalog: query_stats, procedure_stats, query_store_stats), so the probe needs per-catalog-entry granularity (the #1664 probe covers only the query-grain + db-grain pairs the built-in tabs read). Availability then has to thread through the compile pipeline to wherever ComposeSourceRouter.Resolve is called, with the same degrade rules (daily missing → hourly capped; hourly missing → raw) — and on a TimescaleDB store with retention active, the raw fallback silently truncates to ~4 days, so the compiled panel should carry the same "clamped, and says so" treatment the expensive-queries panel got in #1664 rather than quietly shortening the window.

Notes

  • On plain PG the raw fallback is complete (no retention policies without the extension), so for that store shape raw-routing is correct, not degraded.
  • DarlingComposeTests gated-live coverage compiles recent windows only, which is why this never tripped CI; a live test with a >3-day window against the plain dev PG would reproduce it today.

🤖 Generated with Claude Code

Activity

  1. added a commit that references this issue on Jul 26, 2026
  2. erikdarlingdata commented on Jul 26, 2026

    @erikdarlingdata
    OwnerAuthor

    Fixed by PR #1675, merged to dev. Live on DARLING01 as of the dev@f899fe94 deploy (2026-07-26).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions