Re: Error code for "terminating connection due to conflict with recovery" - Mailing list pgsql-hackers

From Simon Riggs
Subject Re: Error code for "terminating connection due to conflict with recovery"
Date
Msg-id 1296504278.1779.2784.camel@ebony
Whole thread Raw
In response to Re: Error code for "terminating connection due to conflict with recovery"  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Error code for "terminating connection due to conflict with recovery"  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Mon, 2011-01-31 at 14:58 -0500, Tom Lane wrote:
> Simon Riggs <simon@2ndQuadrant.com> writes:
> > On Mon, 2011-01-31 at 11:24 -0500, Robert Haas wrote:
> >> , or to use a new
> >> error code.  ERRCODE_ADMIN_SHUTDOWN is just strange.
> 
> > It's not strange at all. It's the same error code as we use for all of
> > the other cases listed. We need that because it is the current
> > catch-all errcode for "cannot retry".
> 
> > The purpose of errcodes is to allow programs to check them and then act.
> > It's pointless to add a new errcode that is so rare that nobody will
> > ever program for it because they won't expect it, let alone test for it.
> > Or at least won't assign any sensible priority to handling that error.
> 
> The trouble with ERRCODE_ADMIN_SHUTDOWN is that it might lead a
> connection pooler to expect that *all* its connections are going bad,
> not just the ones that are connected to a specific database.  I think
> this is a bad decision.  Programs that are interested in testing for this
> case at all are likely to need to be worried about that distinction.

That's a reasonable argument.

My objection to a new code is only to one that is so specific that
people have to program for ERRCODE_BLUE_MOON_ON_A_LEAP_YEAR.

Can we invent a new "catch-all" that might be used here? Something that
means "unknown operational error, not sure what to do".

ERRCODE_ADMIN_OTHER or ERRCODE_ADMIN_UNCLASSIFIED.

> Also, while I believe that ERRCODE_T_R_DEADLOCK_DETECTED is a reasonable
> catchall retry code, I don't think it's equally sane to think that
> ERRCODE_ADMIN_SHUTDOWN is a catchall non-retry code.

-- Simon Riggs           http://www.2ndQuadrant.com/books/PostgreSQL Development, 24x7 Support, Training and Services



pgsql-hackers by date:

Previous
From: "Kevin Grittner"
Date:
Subject: Re: SSI patch version 14
Next
From: Jürgen Wolfsgruber
Date:
Subject: Problem with postgresql database connection in combination with HUAWEI data modem