Fast Shutdown and Transactions

From: Alan Gutierrez <alan(at)prettyrobots(dot)com>
To: pgsql-admin(at)postgresql(dot)org
Subject: Fast Shutdown and Transactions
Date: 2011-06-24 21:27:42
Message-ID: 591CB8F5-CE42-4ACF-8E43-ACE5A152DB35@prettyrobots.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

I'm implementing failover for streaming replication using HAProxy. I'm
trying to implement soft failover, (or failback), that will give
applications in the midst of transaction a clear indication of the
state of their transaction.

My question is, if you use:

pg_ctl -D [DIR] stop -m fast

and the application has issue a commit if a transaction and the
transaction has completed, will postmaster send an affirmative message
before shutting down? Or will it just close the socket?

I can see that stopping fast while a transaction is open in psql will
not generate a message until the next statement.

I'm concerned about the case where an application detects that the
connection has been terminated and assumes that the transaction
failed, so it reattempts the transaction and creates duplicates. I'd
like applications to be able to assume that a dropped connection is a
failed transaction.

Is there some other, better way to check to see if your transaction
was successful or not? One that can be performed across a subsequent
connection?

--
Alan Gutierrez - http://twitter.com/bigeasy - http://github.com/bigeasy

Browse pgsql-admin by date

  From Date Subject
Next Message Iñigo Martinez Lasala 2011-06-27 11:31:17 Urgent! Log full with inexistent PID processes
Previous Message Bob Lunney 2011-06-24 21:21:36 Parallel pg_dump on a single database