Fix bug when primary node is not the youngest. Before pgpool-II
authorTatsuo Ishii <ishii at sraoss.co.jp>
Wed, 20 Oct 2010 01:08:55 +0000 (01:08 +0000)
committerTatsuo Ishii <ishii at sraoss.co.jp>
Wed, 20 Oct 2010 01:08:55 +0000 (01:08 +0000)
commit5ae03c3e1e1cae2fe77ba2d661d46cd16cb83db7
treeb6ead52b5adb0122a227250b5a4951824494aa5e
parentd057e4a23a70b7a8d5f4b2cdd8dc27e59ace02b7
Fix bug when primary node is not the youngest. Before pgpool-II
unconditionally assumed the master node(the youngest live node) is a
primary server, which is apprently wrong assumption. To fix the
problem, now pgpool-II have info on shmem(Req_info) to know which is
the primary. The info is set when 1)pgpool-II started 2)failover
occurs. The work is done by new function find_primary_node(main.c). It
does SELECT pg_is_in_recovery() AND pgpool_walrecrunning() to know the
node in question is actually standby. pgpool_walrecrunning() is new
PostgreSQL C function, to check if walreceiver is in running
status. This is neccessary when failover occurs. Unfortunately
pg_is_in_recovery() returns true even if standby is promoting because
it found a trigger file. Installing pgpool_walrecrunning() is annoying
but no way.  Also where_to_send() is modified to use PRIMARY_NODE_ID,
rather than MASTER_NODE_ID.  CVS:
----------------------------------------------------------------------
main.c pool.h pool_query_context.c pool_worker_child.c CVS: Added
Files: CVS: sql/pgpool-walrecvrunning/Makefile CVS:
sql/pgpool-walrecvrunning/pgpool-walrecrunning.c CVS:
sql/pgpool-walrecvrunning/pgpool-walrecrunning.sql.in CVS:
----------------------------------------------------------------------
child.c
main.c
pool.h
pool_query_context.c
pool_worker_child.c
sql/pgpool-walrecvrunning/Makefile [new file with mode: 0644]
sql/pgpool-walrecvrunning/pgpool-walrecrunning.c [new file with mode: 0644]
sql/pgpool-walrecvrunning/pgpool-walrecrunning.sql.in [new file with mode: 0644]