Fast Shutdown and Transactions - Mailing list pgsql-admin

From Alan Gutierrez
Subject Fast Shutdown and Transactions
Date
Msg-id 591CB8F5-CE42-4ACF-8E43-ACE5A152DB35@prettyrobots.com
Whole thread Raw
List 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

pgsql-admin by date:

Previous
From: Bob Lunney
Date:
Subject: Parallel pg_dump on a single database
Next
From: Iñigo Martinez Lasala
Date:
Subject: Urgent! Log full with inexistent PID processes