Fix pgpool child process segfault reported in [pgpool-hackers: 2312].
authorTatsuo Ishii <ishii@postgresql.org>
Thu, 4 May 2017 08:00:02 +0000 (17:00 +0900)
committerTatsuo Ishii <ishii@postgresql.org>
Thu, 4 May 2017 08:00:02 +0000 (17:00 +0900)
commit8ca1e409868edc0a7cfe0d81fa76a09315cc4438
treeeace60af54390f8aa36913ff6628b1094efcd3b8
parent21a3389de7eb53adde5d4d2731a5a4ece810014f
Fix pgpool child process segfault reported in [pgpool-hackers: 2312].

When MASTER macro calls, pool_virtual_master_db_node_id() which calls
pool_get_preferred_master_node_id() if there's no query context
exists. The segfault happens in deciding the load balance node while
initializing the session context in the child process starting up. The
session context is first initialized with all 0, then
pool_get_preferred_master_node_id() returns 0 as the preferred node
id. This is fine as long as node 0 is healthy. However if node 0 goes
down and failover happens, this is not fine any more since the
connection slot 0 is empty and it causes the segfault.

Fix it by removing preferred_master_node_id staffs since it seems it
is not used anymore.
src/context/pool_query_context.c
src/context/pool_session_context.c
src/include/context/pool_session_context.h
src/parser/gram.c
src/parser/gram.h
src/protocol/pool_proto_modules.c