From 5c550d3a7fee0279b78ba92e5c329596c5b84d5f Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Fri, 7 May 2021 11:37:19 +0200 Subject: [PATCH] Fixes #21358. Failover with half votes. --- defaults/main.yml | 3 +++ templates/pgpool.conf.j2 | 1 + 2 files changed, 4 insertions(+) diff --git a/defaults/main.yml b/defaults/main.yml index e2e6b01..7c08cf7 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -66,6 +66,9 @@ pgpool_white_function_list: '' pgpool_black_function_list: 'nextval,setval' pgpool_allow_sql_comments: 'on' pgpool_fail_over_on_backend_error: 'on' +# Important: set to off when the cluster has an even number of nodes and they are 4 or more +# See https://www.pgpool.net/docs/latest/en/html/runtime-watchdog-config.html#GUC-ENABLE-CONSENSUS-WITH-HALF-VOTES +pgpool_enable_consensus_with_half_votes: 'on' pgpool_relcache_expire: 3600 # pgpool_memory_cache_enabled: False diff --git a/templates/pgpool.conf.j2 b/templates/pgpool.conf.j2 index 9009d9f..15ff4af 100644 --- a/templates/pgpool.conf.j2 +++ b/templates/pgpool.conf.j2 @@ -394,6 +394,7 @@ failback_command = '' # %% = '%' character {% if pgpool_version is version_compare('4.1.4', '>=') %} +enable_consensus_with_half_votes = {{ pgpool_enable_consensus_with_half_votes }} failover_on_backend_error = {{ pgpool_fail_over_on_backend_error }} {% else %} fail_over_on_backend_error = {{ pgpool_fail_over_on_backend_error }}