From 0b94cd9f0d6591e9e5d230f1d5b074297916f023 Mon Sep 17 00:00:00 2001 From: Tatsuo Ishii Date: Sun, 17 Mar 2024 10:11:04 +0900 Subject: [PATCH] Enhance the stability of detach_false_primary. It was possible that enabling detach_false_primary caused that all backend nodes went down. Suppose watchdog is enabled and there are 3 watchdog nodes pgpool0, pgpool1 and pgpool2. If pgpool0 and pgpool1 find primary PostgreSQL goes down due to network trouble between pgpool and PostgreSQL, they promote a standby node. pgpool2 could find that there are two primary nodes because the backend status at pgpool2 has not been synced with pgpool0 and pgpool1, and pgpool2 perform detach_false_primary against the standby, which is being promoted. To prevent the issue, now detach_false_primary is performed only by watchdog leader node. With this, pgpool will not see half baked backend status and the issue described above will not happen. Discussion: https://www.pgpool.net/pipermail/pgpool-hackers/2024-February/004432.html ([pgpool-hackers: 4431] detach_false_primary could make all nodes go down) --- doc.ja/src/sgml/failover.sgml | 6 + doc/src/sgml/failover.sgml | 11 ++ src/streaming_replication/pool_worker_child.c | 70 ++++++++++- .../tests/081.detach_primary_all_down/test.sh | 119 ++++++++++++++++++ 4 files changed, 202 insertions(+), 4 deletions(-) create mode 100755 src/test/regression/tests/081.detach_primary_all_down/test.sh diff --git a/doc.ja/src/sgml/failover.sgml b/doc.ja/src/sgml/failover.sgml index 4e25902a8..ea87a45f5 100644 --- a/doc.ja/src/sgml/failover.sgml +++ b/doc.ja/src/sgml/failover.sgml @@ -934,6 +934,12 @@ if (we need to executed follow primary command) + + + watchdogが有効な場合、不正なプライマリの切り離しは、リーダーwatchdogでのみ実施されます。 + たとえがオンでも、この機能によるプライマリの切り離しは、リーダーwatchdogの判断だけで行われ、多数派の承認は必要とされません。 + +