Now It's still working.
If shutdown occured, postgres send an error which error code is "57P01" and error message is "terminating connection due to administrator command". However, another nodes did not send any messages. pgpool waited for a message from them. when the error is sended, pgpool reads the message and degenerate.
* Fixed kind mismatch error when deadlock error occured. The problem is the following senario. A: BEGIN: B: BEGIN; A: LOCK TABLE t1 IN SHARE ROW EXCLUSIVE MODE; B: LOCK TABLE t2 IN SHARE ROW EXCLUSIVE MODE; A: LOCK TABLE t2 IN SHARE ROW EXCLUSIVE MODE; B: LOCK TABLE t1 IN SHARE ROW EXCLUSIVE MODE; Transaction "A" aborts on master node, but it completes on another nodes. It causes wrong failover. So pgpool checks deadlock error(code == '40P01') and sends error query to another nodes.
Normally, this case solve to call pselect(2). But Linux's pselect(2) is emulated by select(2) and sigprocmask(2). It contains this race. So pgpool archieves using the self-pipe trick. See 'man pselect' if you want to get more information.
But this way had the following problems. psql>\d accounts Did not find any relation with OID XXX pgpool chooses it after receiving AuthenticationOK('R') message. So pgpool load balance to the same node inside a same session.
We fixed signal handling at revision 1.6. That fix was to set a flag in signal handler, then pgpool checked flags in safe points. However It has a race condition in the following case. CHECK_REQUEST; <-- check flags <signal handler> <-- set flags pause(); <-- wait for signals So, we modified to deliver signals in safe places which are in pause() and sleep().
tuples in CommandComplete message. If these numbers are not same, a transaction is aborted by pgpool. It is for data consistency. TODO: This behavior will be able to switch by pgpool.conf.
call SIGUSR2 handler in CHECK_REQUEST macro.
occurs only in simple query protocol.
only, then a parent process checks flags in signal safe places.