In summary it's an expected behavior. You saw that when second node went down, the session was not disconncted is a bug with 2.1. In the CVS head you will see the same behavior regardless which node goes down.
The reason for this change was explained in the following thread: http://lists.pgfoundry.org/pipermail/pgpool-general/2008-July/001119.html -- Tatsuo Ishii SRA OSS, Inc. Japan > 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" > _______________________________________________ > Pgpool-general mailing list > [email protected] > http://pgfoundry.org/mailman/listinfo/pgpool-general _______________________________________________ Pgpool-general mailing list [email protected] http://pgfoundry.org/mailman/listinfo/pgpool-general
