Repository navigation
Description
Problem
The scheduled analytics_collect pipeline (internal/server/analytics_collect.go::handleCollectAnalytics) runs partition provisioning, retention, and materialized-view refresh as long-running DDL statements on the context handed in by the scheduled-task entrypoint (http.go / lambda.go). That context carries no per-step DB deadline.
Under RDS Proxy a session-level statement_timeout is not honoured, so a runaway DDL step (for example a REFRESH MATERIALIZED VIEW CONCURRENTLY blocked on a lock) could hang the entire scheduled run indefinitely.
Evidence
Finding 06-N3 from the data-layer review (docs/code-review source 06-data-layer.md), folded into PR #1049:
analytics/postgres_analytics.go:352,364,396- Ensure callers pass bounded ctx toCreatePartition/DropOldPartitions/RefreshMaterializedViews(no statement_timeout under RDS Proxy).
Fix
Bound each DDL step in handleCollectAnalytics with a per-step child context (analyticsDDLTimeout, 5m) so the pipeline makes forward progress or fails fast rather than hanging. Implemented in PR #1049.
Files
internal/server/analytics_collect.go
Verification
Regression test TestHandleCollectAnalytics_DDLStepsAreBounded runs the pipeline under a deadline-free parent context and asserts each DDL step observes a deadline (so the bound can only have come from the pipeline itself). Pre-fix the steps inherited the unbounded parent and the assertion fails.
Activity
fix(analytics): bound scheduled DDL steps with a per-step timeout
feat(analytics): finish & wire historical savings snapshots (closes #…