[pgpool-committers: 9958] pgpool: Fix MAIN_NODE macro (actually pool_virtual_main_db_node_id()).
Tatsuo Ishii
ishii at sraoss.co.jp
Fri Jun 21 14:46:10 JST 2024
Fix MAIN_NODE macro (actually pool_virtual_main_db_node_id()).
The macro used to REAL_MAIN_NODE_ID if there's no session context.
This is wrong since REAL_MAIN_NODE_ID can be changed any time when
failover/failback happens. Suppose REAL_MAIN_NODE_ID ==
my_main_node_id == 1. Then due to failback, REAL_MAIN_NODE_ID is
changed to 0. Then MAIN_CONNECTION(cp) will return NULL and any
reference to it will cause segmentation fault. To prevent the issue we
should return my_main_node_id instead.
Discussion: https://www.pgpool.net/pipermail/pgpool-general/2024-June/009205.html
Backpatch-through: V4.1
Branch
------
V4_5_STABLE
Details
-------
https://git.postgresql.org/gitweb?p=pgpool2.git;a=commitdiff;h=85a5ba018cd1c5cbdd2ce9e66d6d68a70003ef93
Modified Files
--------------
src/context/pool_query_context.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
More information about the pgpool-committers
mailing list