[pgpool-committers: 3243] pgpool: Deal with the case when the primary is not node 0 in streaming

Tatsuo Ishii ishii at postgresql.org
Wed May 25 11:27:52 JST 2016


Deal with the case when the primary is not node 0 in streaming replication mode.

http://www.pgpool.net/mantisbt/view.php?id=194#c837 reported that if
primary is not node 0, then statement timeout could occur even after
bug194-3.3.diff was applied. After some investigation, it appeared
that MASTER macro could return other than primary or load balance
node, which was not supposed to happen, thus do_query() sends queries
to wrong node (this is not clear from the report but I confirmed it in
my investigation).

pool_virtual_master_db_node_id(), which is called in MASTER macro
returns query_context->virtual_master_node_id if query context
exists. This could return wrong node if the variable has not been set
yet. To fix this, the function is modified: if the variable is not
either load balance node or primary node, the primary node id is
returned.

For master and 3.5-stable, additional fixes/enhancements are made:
pool_extended_send_and_wait() now issues flush message if the request
is 'E' (execute). Before it was issued outside (in Execute), but this
makes the logic to determine to which node the flush message to be
sent unnecessary complex.

A debug message in pool_write is enhanced by adding backend node id.

Branch
------
master

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

Modified Files
--------------
src/context/pool_query_context.c  | 34 +++++++++++++++++++++++++++++++++-
src/protocol/pool_proto_modules.c |  6 +++++-
src/utils/pool_stream.c           |  2 +-
3 files changed, 39 insertions(+), 3 deletions(-)



More information about the pgpool-committers mailing list