[pgpool-committers: 3353] 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_2_STABLE
Details
-------
http://git.postgresql.org/gitweb?p=pgpool2.git;a=commitdiff;h=2c522ca2a000a5f15f7d78bfe65bb3265a701d5c
Modified Files
--------------
child.c | 8 +++++++-
pool.h | 2 +-
pool_session_context.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++
pool_session_context.h | 12 +++++++++++-
pool_timestamp.c | 3 +--
test/timestamp/main.c | 15 +++++++++++++++
6 files changed, 82 insertions(+), 5 deletions(-)
More information about the pgpool-committers
mailing list