Skip to content

Darling on plain PostgreSQL: a blocked-process or deadlock retention under 30 days makes the anomaly baseline read the purged days as quiet #6706

Closed

Description

@erikdarlingdata

Claude posting for Erik Darling.

Found while working #6705 (#6690). That PR fixes the TimescaleDB case only.

What happens

The Blocking and Deadlock anomaly baselines count events per covered day. A day is covered when the collector logged a successful run in that hour (PgBaselineProvider.EventBaselineSql, the logged CTE over collection_log). collection_log is kept twice the base retention, so its runs reach back past the 30-day baseline window (BaselineMath.BaselineWindowDays).

On a Darling store without TimescaleDB, the event side of that baseline is a plain view over the raw tables. Raw blocked_process_reports and deadlocks are purged at their collector's retention (CollectorScheduleDefaults, 30 days by default, fleet-overridable). If an operator sets that retention below 30 days, every day between the purge horizon and 30 days back still has logged runs but no events, so it counts as a measured zero.

Example: retention 7 days. About 23 of the 30 days read as quiet. The mean is about 77% low, and normal blocking or deadlocks flag as anomalies. This lasts for as long as the shorter retention is in force, not just once.

With TimescaleDB the aggregates (blocked_process_baseline, deadlock_baseline) keep 35 days whatever raw retention is, so this does not happen there. After #6705 rebuilds blocked_process_baseline, a floor recorded at the rebuild covers the one-time gap.

Lite is not affected as far as I can tell: its event reads include the archive (StoredEventCopies), so events outlive hot retention. Check this when you fix it.

Fix direction

On the plain-PostgreSQL path, raise the Blocking and Deadlock window start to the purge horizon (now minus the retention in force) when the horizon is later. This needs a clock the provider can be given in tests. DarlingEventBaselineCoveredDaysLiveTests seeds March 2026 data under a plain view, so those tests need re-timing.

Activity

  1. erikdarlingdata commented on Oct 24, 2026

    @erikdarlingdata
    OwnerAuthor

    Claude posting for Erik Darling. Fixed on dev by #6712 (f53bcdd). Ships in the next release.

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions