[pgpool-committers: 3358] pgpool: Replace "MAJOR" macro to prevent occasional failure.

Tatsuo Ishii ishii at postgresql.org
Wed Jul 27 17:01:19 JST 2016


Replace "MAJOR" macro to prevent occasional failure.

It is reported that the macro could cause segfault
[http://www.pgpool.net/mantisbt/view.php?id=225].  The macro calls
pool_virtual_master_db_node_id() and then access
backend->slots[id]->con using the node id returned.  In rare cases, it
could point to 0 (in case when the DB node is not connected), which
gives access to con->major, then it causes a segfault.

Since the intention of the macro is obtaining the protocol major
number, it is a little bit pointless to keep the info on the data for
each DB node because the number should be identical among DB
nodes. To fix this, now we have the protocol major and minor version
numbers in the session context and they are set when pgpool-II
connects to backend. The setter and getter functions are added .The
macro now just returns the stored data by using the getter function
(this will save a few cpu cycle).

Branch
------
V3_1_STABLE

Details
-------
http://git.postgresql.org/gitweb?p=pgpool2.git;a=commitdiff;h=27ed295f1934f01776ff19a45c42cbd7272a31ad

Modified Files
--------------
Makefile.in            | 554 +++++++++++++++++++--------------
aclocal.m4             | 825 ++++++++++++++++++++++++++++++++++---------------
child.c                |   8 +-
configure              | 335 +++++++++++++++-----
parser/Makefile.in     | 266 +++++++++++-----
pcp/Makefile.in        | 359 ++++++++++++++-------
pool.h                 |   2 +-
pool_session_context.c |  47 +++
pool_session_context.h |  14 +-
pool_timestamp.c       |   3 +-
test/timestamp/main.c  |  15 +
11 files changed, 1668 insertions(+), 760 deletions(-)



More information about the pgpool-committers mailing list