Re: [HACKERS] Determine if an error is transient by its error code. - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [HACKERS] Determine if an error is transient by its error code.
Date
Msg-id 16281.1489980932@sss.pgh.pa.us
Whole thread Raw
In response to Re: [HACKERS] Determine if an error is transient by its error code.  (Craig Ringer <craig@2ndquadrant.com>)
List pgsql-hackers
Craig Ringer <craig@2ndquadrant.com> writes:
> On 20 March 2017 at 10:26, Dominick O'Dierno <odiernod@gmail.com> wrote:
>> Essentially I want to determine by the error code if it is worth retrying
>> the call (transient) or if the error was due to a bad query or programmer
>> error, in which case don't retry.

> In general you'll need classes of retry:
> * just reissue the query (deadlock retry, etc)
> * reconnect and retry

Yeah.  There's a pretty significant fraction of these where just blindly
repeating the failing query isn't likely to help; the error code is meant
to suggest that the DBA has to fix something, eg adjust configuration
limits.  I'm also pretty dubious about the value of a blind retry for,
eg, disk_full.

One you missed that I think *is* supposed to imply "just retry" is
40001 serialization_failure.  You have to retry the whole transaction
though, not just one query.
        regards, tom lane



pgsql-hackers by date:

Previous
From: Craig Ringer
Date:
Subject: Re: [HACKERS] Determine if an error is transient by its error code.
Next
From: Andres Freund
Date:
Subject: Re: [HACKERS] WIP: Faster Expression Processing v4