pgpool: Feature: Wait for follow_primary completion and report failure

From: Taiki Koshino <koshino(at)sraoss(dot)co(dot)jp>
To: pgpool-committers(at)lists(dot)postgresql(dot)org
Subject: pgpool: Feature: Wait for follow_primary completion and report failure
Date: 2026-11-13 02:25:26
Message-ID: E1xRgyk-00000003feU-1hB3@gothos.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgpool-committers

Feature: Wait for follow_primary completion and report failure in pcp_promote_node.

This commit enhances the pcp_promote_node command to wait for completion of failover
and follow_primary processing, and reports which script failed when an error occurs
in the failover or follow_primary script.

Add pcp_promote_node_wait and pcp_promote_failed_command members to Req_info.
The PCP worker sets pcp_promote_node_wait to true before initiating failover
and waits until it becomes false by the failover or follow_primary execution side.

The failover and follow_primary execution side set pcp_promote_node_wait to false
when processing finishes. If an error occurs during script execution, they store
the failed command in pcp_promote_failed_command.

If failover or follow_primary command execution fails, pcp_promote_node reports
an ERROR with the failed command instead of returning success, allowing users
to detect failures directly from the command result.

Discussion: https://github.com/pgpool/pgpool2/issues/147

Branch
------
master

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

Modified Files
--------------
src/include/pool.h | 5 +
src/main/pgpool_main.c | 17 ++
src/pcp_con/pcp_worker.c | 30 +++
src/test/regression/tests/034.promote_node/test.sh | 180 ++++++++++++++-
src/test/regression/tests/046.detach_node/test.sh | 257 +++++++++++++++++++++
.../tests/127.invalid_failover_node/test.sh | 2 +-
6 files changed, 487 insertions(+), 4 deletions(-)

Browse pgpool-committers by date

  From Date Subject
Next Message Tatsuo Ishii 2026-11-13 05:37:02 pgpool: Test: stabilize 038.pcp_commands.
Previous Message Tatsuo Ishii 2026-11-13 01:14:53 pgpool: Fix segfault when a watchdog sync changes the primary under run