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:
----------------------------------------------------------------------