pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alan Gutierrez <alan@prettyrobots.com>
To: pgsql-admin@postgresql.org
Subject: Fast Shutdown and Transactions
Date: Fri, 24 Jun 2011 17:27:42 -0400
Message-ID: <591CB8F5-CE42-4ACF-8E43-ACE5A152DB35@prettyrobots.com> (raw)

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



Message-ID: <591CB8F5-CE42-4ACF-8E43-ACE5A152DB35@prettyrobots.com>
Permalink:  ../591CB8F5-CE42-4ACF-8E43-ACE5A152DB35@prettyrobots.com/
Also on:    postgresql.org/message-id/591CB8F5-CE42-4ACF-8E43-ACE5A152DB35@prettyrobots.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: alan@prettyrobots.com
  Subject: Re: Fast Shutdown and Transactions
  In-Reply-To: <591CB8F5-CE42-4ACF-8E43-ACE5A152DB35@prettyrobots.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox