Skip site navigation (1) Skip section navigation (2)

Re: Error code for "terminating connection due to conflict with recovery"

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Simon Riggs <simon(at)2ndquadrant(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Kevin Grittner <Kevin(dot)Grittner(at)wicourts(dot)gov>, Bruce Momjian <bruce(at)momjian(dot)us>, fgp(at)phlo(dot)org, Tatsuo Ishii <ishii(at)postgresql(dot)org>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Error code for "terminating connection due to conflict with recovery"
Date: 2011-01-31 23:21:06
Message-ID: AANLkTik2Ptbr53wMZii-BFygWWbsEcdxk18jd2QapFcX@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-hackers
On Mon, Jan 31, 2011 at 6:07 PM, Simon Riggs <simon(at)2ndquadrant(dot)com> wrote:
> On Mon, 2011-01-31 at 16:24 -0500, Tom Lane wrote:
>> Simon Riggs <simon(at)2ndQuadrant(dot)com> writes:
>> > On Mon, 2011-01-31 at 14:58 -0500, Tom Lane wrote:
>> >> 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.
>>
>> What's wrong with ERRCODE_DATABASE_DROPPED, or something like that?
>>
>> > Can we invent a new "catch-all" that might be used here? Something that
>> > means "unknown operational error, not sure what to do".
>>
>> Because that's not the situation here.  We know exactly what a pooler
>> should do.  It might be an infrequent case, but obscurantism isn't going
>> to help anyone.
>
> OK, that makes sense to me.
>
> I would make ERRCODE_DATABASE_DROPPED an Invalid Authorization error,
> rather than a Transaction Rollback code. So sqlstate 28P02
>
> The sensible handling of such an error is not to retry, or at least to
> switch to an alternate if one is available.
>
> Ready to commit if no objection.

ISTM it should still be in class 40.  There's nothing wrong with the
user's authorization; we've just decided to roll back the transaction
for our own purposes.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

pgsql-hackers by date

Next:From: YAMAMOTO TakashiDate: 2011-01-31 23:39:24
Subject: Re: [NOVICE] systable_getnext_ordered
Previous:From: Simon RiggsDate: 2011-01-31 23:07:27
Subject: Re: Error code for "terminating connection due to conflict with recovery"

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group