Replace "MAJOR" macro to prevent occasional failure.
authorTatsuo Ishii <ishii@postgresql.org>
Wed, 27 Jul 2016 05:28:28 +0000 (14:28 +0900)
committerTatsuo Ishii <ishii@postgresql.org>
Wed, 27 Jul 2016 07:58:54 +0000 (16:58 +0900)
commit27ed295f1934f01776ff19a45c42cbd7272a31ad
treea983e764a72ac17d6119af9f23670d9d95107019
parent273eb89be6ae8ebdda9ba4f9eeb5c1935ea12b19
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).
Makefile.in
aclocal.m4
child.c
configure
parser/Makefile.in
pcp/Makefile.in
pool.h
pool_session_context.c
pool_session_context.h
pool_timestamp.c
test/timestamp/main.c