Enhance the stability of detach_false_primary.
authorTatsuo Ishii <ishii@sraoss.co.jp>
Sat, 16 Mar 2024 13:07:17 +0000 (22:07 +0900)
committerTatsuo Ishii <ishii@sraoss.co.jp>
Sat, 16 Mar 2024 13:24:46 +0000 (22:24 +0900)
commitc5b25883d21a180ec54a2fea9de67d5da1367464
tree129af5925c74badcc63b535951f2d414e0c06f2e
parent2de41edefea9300763a3c990f9f07c4956861cbd
Enhance the stability of detach_false_primary.

It was possible that enabling detach_false_primary caused that all
backend node 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 situation, now detach_false_primary is performed by only
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
doc/src/sgml/failover.sgml
src/protocol/pool_proto_modules.c
src/test/regression/tests/081.detach_primary_all_down/test.sh [new file with mode: 0755]