Classify Postgres program-limit-exceeded errors (SQLSTATE class 54)#4595
Closed
iskakaushik wants to merge 1 commit into
Closed
Classify Postgres program-limit-exceeded errors (SQLSTATE class 54)#4595iskakaushik wants to merge 1 commit into
iskakaushik wants to merge 1 commit into
Conversation
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.
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 theOTHERcatch-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 — witherrorClass=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
TestPostgresProgramLimitExceededErrorShouldBeNotifyTelemetrywith the real error message from the incident;go test ./alerting/passes (except two pre-existing tests requiring a live local Postgres).