[Pgpool-general] Error message when sending query that causes failover

Jaume Sabater jsabater at linuxsilo.net
Fri Nov 7 11:11:22 UTC 2008


Hello everyone!

I have two instances of PostgreSQL running behind pgpool-II 2.1 with
connection pooling, replication and load balancing. Online recovery is
working fine with PITR. Now I have this situation:

- I send an UPDATE statement to the cluster and it goes fine.
- I shutdown PostgreSQL on the master node.
- I send another UPDATE statement to the cluster (before the health
check happens) and pgpool-II detects the master node is down, therefore
it returns an error and does not execute the SQL statement. It does the
failover correctly, though.
- I send the same UPDATE again and it works fine (on the remaining node
only, of course).

What I was expecting is that, when I send the UPDATE statement and
pgpool-II realises it is unable to contact the node, it would do
failover AND execute the statement on the remaining node. And return an
OK to the client.

Here you are some code, made on the classic table structure of pgbench:

$ psql -h 10.0.33.252 -p 9999 -U pgpool2 -d bench_replication -c "UPDATE
ACCOUNTS SET abalance = 1011 WHERE aid = 10"
UPDATE 1
"/etc/init.d/postgresql stop" on master node
$ psql -h 10.0.33.252 -p 9999 -U pgpool2 -d bench_replication -c "UPDATE
ACCOUNTS SET abalance = 1012 WHERE aid = 10"
psql: server closed the connection unexpectedly
	This probably means the server terminated abnormally
	before or while processing the request.
$ psql -h 10.0.33.252 -p 9999 -U pgpool2 -d bench_replication -c "SELECT
abalance FROM ACCOUNTS WHERE aid = 10"
 abalance
----------
     1011
(1 row)

This does not happen if I shutdown the slave node, only the master.

Is this the expected behaviour? Is there any way to change it?

Thanks in advance.

--
Jaume Sabater
http://linuxsilo.net/

"Ubi sapientas ibi libertas"


More information about the Pgpool-general mailing list