[Pgpool-hackers] Detaching, then attaching node results in weird status

Guillaume Lelarge guillaume at lelarge.info
Mon May 23 08:40:39 UTC 2011


Hi,

I tried something quite simple today. I configured pgpool to have access
to one backend:

backend_hostname0 = 'localhost'
backend_port0 = 5432

I configured pcp.conf, so that I could get info on my node.

I launched PostgreSQL (9.0), and pgPool (3.0). And here is what I did
right after:

bin/pcp_node_info 10 localhost 9898 postgres postgres 0
localhost 5432 1 nan                   => this is fine

psql -h localhost -p 9999 postgres     => connection OK

bin/pcp_node_info 10 localhost 9898 postgres postgres 0
localhost 5432 2 nan                   => this is fine

Now I detach node 0:

bin/pcp_detach_node 10 localhost 9898 postgres postgres 0

bin/pcp_node_info 10 localhost 9898 postgres postgres 0
localhost 5432 3 nan                   => still fine

And then I reattach node 0:
bin/pcp_attach_node 10 localhost 9898 postgres postgres 0

bin/pcp_node_info 10 localhost 9898 postgres postgres 0
localhost 5432 3 nan

pgPool is only on connection pooling mode (no replication mode, no load
balancing mode). I was expecting to see a status 1. Is there any reason
I don't see that would explain that behaviour?

BTW, I have the same issue if someone shutdowns and then launches
PostgreSQL.

I have a small patch that fixes the first issue, but not the second one:

diff -c -p -r1.85.2.7 main.c
*** main.c	2 Apr 2011 23:45:56 -0000	1.85.2.7
--- main.c	23 May 2011 08:37:33 -0000
*************** void send_failback_request(int node_id)
*** 1282,1287 ****
--- 1282,1290 ----

  	if (node_id < 0 || node_id >= MAX_NUM_BACKENDS || VALID_BACKEND(node_id))
  	{
+ 	    if (!(pool_config->master_slave_mode == 0 ||
+             strcmp(pool_config->master_slave_sub_mode, MODE_STREAMREP)))
+ 		    BACKEND_INFO(node_id).backend_status = CON_CONNECT_WAIT;
  		pool_error("send_failback_request: node %d is alive.", node_id);
  		return;
  	}

Regards.


-- 
Guillaume
 http://www.postgresql.fr
 http://dalibo.com


More information about the Pgpool-hackers mailing list