Skip to content

Classify Postgres program-limit-exceeded errors (SQLSTATE class 54)#4595

Closed
iskakaushik wants to merge 1 commit into
mainfrom
kaushik/notify-program-limit-exceeded
Closed

Classify Postgres program-limit-exceeded errors (SQLSTATE class 54)#4595
iskakaushik wants to merge 1 commit into
mainfrom
kaushik/notify-program-limit-exceeded

Conversation

@iskakaushik

Copy link
Copy Markdown
Contributor

What

Adds a dedicated error class NOTIFY_PROGRAM_LIMIT_EXCEEDED (action: notify_telemetry) for PostgreSQL SQLSTATE class 54 errors: program_limit_exceeded (54000), statement_too_complex (54001), too_many_columns (54011), too_many_arguments (54023). Previously these fell through the Postgres error switch to the OTHER catch-all.

Why

A PG→PG mirror hit index row size 3176 exceeds btree version 4 maximum 2704 for index ... on the destination during initial load (a btree index on an oversized text value). The sync batch retried every ~2 minutes for ~22 hours — ~1.5k errors — with errorClass=OTHER, which internal alerting cannot key on without drowning in unclassified noise, so nobody was alerted until the customer noticed.

Class-54 errors are deterministic: retrying can never succeed (the same oversized tuple fails every time), and the fix requires intervention (e.g. dropping/replacing the offending destination index). A dedicated class lets telemetry alerting route them to the team.

Testing

Added TestPostgresProgramLimitExceededErrorShouldBeNotifyTelemetry with the real error message from the incident; go test ./alerting/ passes (except two pre-existing tests requiring a live local Postgres).

Destination errors like 'index row size N exceeds btree version 4 maximum
M for index ...' (SQLSTATE 54000) previously fell through to the OTHER
catch-all, so a permanently failing sync retried forever without internal
alerting picking it up. Give SQLSTATE class 54 (program_limit_exceeded,
statement_too_complex, too_many_columns, too_many_arguments) a dedicated
NOTIFY_PROGRAM_LIMIT_EXCEEDED class so telemetry alerting can route it:
these errors never succeed on retry and need intervention.
@iskakaushik
iskakaushik requested a review from a team as a code owner July 18, 2026 01:35
@claude

claude Bot commented Jul 18, 2026

Copy link
Copy Markdown

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant