[pgpool-committers: 9169] pgpool: Fix sr worker to not send wrong query to standby server in corn

Tatsuo Ishii ishii at sraoss.co.jp
Sun Feb 5 17:16:51 JST 2023


Fix sr worker to not send wrong query to standby server in corner case.

When ALWAYS_PRIMARY flag is set, PRIMARY_NODE_ID macro returns node
id, rather than -1 even if the primary is down. This confuses the test
if a node is primary or not, because PRIMARY_NODE_ID macro returns
main node id.  In this case streaming replication delay check worker
sends "SELECT pg_current_wal_lsn()" or "SELECT
pg_current_xlog_location()" depending on PostgreSQL's version to
standby which of course raises an error.

To fix this, test the primary node is down or not, and if it's down,
skip the replication delay loop. If primary is down, there's no point
to perform streaming replication delay checking anyway.

Discussion: https://www.pgpool.net/pipermail/pgpool-hackers/2023-February/004279.html
Backpatch-through: 4.0

Branch
------
V4_1_STABLE

Details
-------
https://git.postgresql.org/gitweb?p=pgpool2.git;a=commitdiff;h=440849e0fcc3d25731f032f9326d785e4ccd13f1

Modified Files
--------------
src/streaming_replication/pool_worker_child.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)



More information about the pgpool-committers mailing list