Fix bug with load balance node id info on shmem
authorTatsuo Ishii <ishii@postgresql.org>
Wed, 15 Jun 2016 07:34:51 +0000 (16:34 +0900)
committerTatsuo Ishii <ishii@postgresql.org>
Wed, 15 Jun 2016 07:34:51 +0000 (16:34 +0900)
commit226a21b19f6a59fe72599d84b4eed9185a0fa1f5
tree8292d8a9964fbca05c3576e7e06fc2ec4d3e780f
parent22065a93ec059b8b1bddd899c0c7f3cf5025b190
Fix bug with load balance node id info on shmem

There are few places where the load balance node was mistakenly put on
wrong place. It should be placed on:
ConnectionInfo *con_info[child id, connection pool_id, backend id].load_balancing_node].
In fact it was placed on:
*con_info[child id, connection pool_id, 0].load_balancing_node].

As long as the backend id in question is 0, it is ok. However while
testing pgpool-II 3.6's enhancement regarding failover, if primary
node is 1 (which is the load balance node) and standby is 0, a client
connecting to node 1 is disconnected when failover happens on node
0. This is unexpected and the bug was revealed.

It seems the bug was there since long time ago but it had not found
until today by the reason above.
src/context/pool_session_context.c
src/protocol/pool_process_query.c