Re: Determine if an error is transient by its error code.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Craig Ringer <craig(at)2ndquadrant(dot)com>
Cc: "Dominick O'Dierno" <odiernod(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Determine if an error is transient by its error code.
Date: 2017-03-20 03:35:32
Message-ID: 16281.1489980932@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Craig Ringer <craig(at)2ndquadrant(dot)com> writes:
> On 20 March 2017 at 10:26, Dominick O'Dierno <odiernod(at)gmail(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2017-03-20 03:48:38 Re: WIP: Faster Expression Processing v4
Previous Message Craig Ringer 2017-03-20 03:25:58 Re: Determine if an error is transient by its error code.