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

Re: smart shutdown at end of transaction (was: Default mode for shutdown)

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Andres Freund <andres(at)anarazel(dot)de>, pgsql-hackers(at)postgresql(dot)org, Robert Haas <robertmhaas(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Magnus Hagander <magnus(at)hagander(dot)net>
Subject: Re: smart shutdown at end of transaction (was: Default mode for shutdown)
Date: 2012-04-29 08:15:55
Message-ID: 1335687355.12058.5.camel@vanquo.pezone.net (view raw or flat)
Thread:
Lists: pgsql-hackers
On lör, 2012-04-28 at 11:12 -0400, Tom Lane wrote:
> Peter Eisentraut <peter_e(at)gmx(dot)net> writes:
> > On fre, 2012-04-27 at 22:30 +0200, Andres Freund wrote:
> >> In the few cases where I investigated it TMs don't use transactions
> >> themselves (which I think is correct, they don't need them), so
> >> terminating any idle session - which the TM would appear as, as its
> >> not using txns - would leave prepared transactions in a limbo state
> >> till the database is up again, instead of waiting till all prepared
> >> transactions are either aborted or committed. It may also choose to
> >> coordinate to abort all transactions, but all that is hard if the
> >> database shuts you out.
> 
> > This would lead to another shutdown mode, one that terminates idle
> > sessions unless they have prepared transactions.  That could be useful.
> 
> Huh?  Prepared transactions aren't associated with sessions.  At least
> not in a context using a TM --- the TM will be doing commits or
> rollbacks from a session different from the ones that ran the prepared
> transactions.

From what Andres wrote I gather that the TM would be using the same
session for preparing and committing.

In any case, if either the existing session of the TM is cut or it
cannot create a new connection, it will, after some time, have to give
up roll back the prepared transactions on the other servers.  So some
kind of setting to not shut down if there are prepared transactions
pending could be useful.  But this could probably be a separate GUC
setting or two instead of a shutdown mode (or two) of its own.



In response to

Responses

pgsql-hackers by date

Next:From: Peter EisentrautDate: 2012-04-29 08:19:51
Subject: Re: smart shutdown at end of transaction (was: Default mode for shutdown)
Previous:From: Robert HaasDate: 2012-04-28 23:41:02
Subject: Re: smart shutdown at end of transaction (was: Default mode for shutdown)

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