[pgpool-committers: 3357] pgpool: Replace "MAJOR" macro to prevent occasional failure.
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).
src/context/pool_session_context.c | 47 ++++++++++++++++++++++
src/include/context/pool_session_context.h | 11 ++++-
src/include/pool.h | 2 +-
src/protocol/child.c | 6 +++
src/rewrite/pool_timestamp.c | 4 +-
.../tests/010.rewrite_timestamp/timestamp/main.c | 5 +++
6 files changed, 72 insertions(+), 3 deletions(-)
More information about the pgpool-committers