From: | Alvaro Herrera <alvherre(at)commandprompt(dot)com> |
---|---|
To: | Robert Haas <robertmhaas(at)gmail(dot)com> |
Cc: | Joachim Wieland <joe(at)mcknight(dot)de>, Jim Nasby <jim(at)nasby(dot)net>, Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: synchronized snapshots |
Date: | 2011-08-16 14:43:20 |
Message-ID: | 1313505498-sup-5621@alvh.no-ip.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Excerpts from Robert Haas's message of mar ago 16 09:59:04 -0400 2011:
> On Mon, Aug 15, 2011 at 6:46 PM, Joachim Wieland <joe(at)mcknight(dot)de> wrote:
> > Also see what Robert wrote about proxies in between that keep track
> > of the transaction state. Consider they see a BEGIN query that
> > fails. How would they know if the session is now in an aborted
> > transaction or not in a transaction at all?
>
> I think the point here is that we should be consistent. Currently,
> you can make BEGIN fail by doing it on the standby, and asking for
> READ WRITE mode:
>
> rhaas=# begin transaction read write;
> ERROR: cannot set transaction read-write mode during recovery
>
> After doing that, you are NOT in a transaction context:
>
> rhaas=# select 1;
> ?column?
> ----------
> 1
> (1 row)
>
> So whatever this does should be consistent with that, at least IMHO.
I think we argued about a very similar problem years ago and the outcome
was that you should be left in an aborted transaction block; otherwise
running a dumb SQL script (which has no way to "abort if it fails")
could wreak serious havoc (?). I think this failure to behave in that
fashion on the standby is something to be fixed, not imitated.
What this says is that a driver or app seeing BEGIN fail should issue
ROLLBACK before going further -- which seems the intuitive way to behave
to me. No?
--
Álvaro Herrera <alvherre(at)commandprompt(dot)com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support
From | Date | Subject | |
---|---|---|---|
Next Message | Robert Haas | 2011-08-16 14:46:55 | Re: synchronized snapshots |
Previous Message | Magnus Hagander | 2011-08-16 14:32:55 | Updated version of pg_receivexlog |