From f6e8478b6112a6a4820ce8ed867a5a05b16d9bf0 Mon Sep 17 00:00:00 2001
From: Mark Goddard <mark@stackhpc.com>
Date: Fri, 1 Nov 2019 15:17:48 +0000
Subject: [PATCH] Enable load balancing to Galera nodes in Donor state
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

We use the wsrep_notify.sh script to notify changes in Galera cluster
membership to haproxy. When xtrabackup was used for the state transfer,
nodes in the Donor state would be included in the backend pool. However,
since the switch to mariabackup in the Stein cycle, we now remove nodes
in the Donor state from the backend pool.

This change ensures that nodes in the Donor state are included in the
backend pool when the SST method is either xtrabackup or mariabackup.

https://galeracluster.com/library/documentation/mysql-wsrep-options.html#wsrep-notify-cmd

Change-Id: Ide4301779a0d221ae5d4dbdd4873fb8a40eb7297
Co-authored-by: Radosław Piliszek <radoslaw.piliszek@gmail.com>
Closes-Bug: #1850945
---
 ansible/roles/mariadb/templates/wsrep-notify.sh.j2 | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/ansible/roles/mariadb/templates/wsrep-notify.sh.j2 b/ansible/roles/mariadb/templates/wsrep-notify.sh.j2
index 73acde3fe..ae53574bb 100644
--- a/ansible/roles/mariadb/templates/wsrep-notify.sh.j2
+++ b/ansible/roles/mariadb/templates/wsrep-notify.sh.j2
@@ -57,7 +57,11 @@ Synced)
 Donor)
     # enabling donor only if xtrabackup configured
     SST_METHOD=`get_sst_method`
-    [[ $SST_METHOD =~ 'xtrabackup' ]] && CMD=$ENABLE_LB || CMD=$DISABLE_LB
+    if [[ $SST_METHOD =~ (mariabackup|xtrabackup) ]]; then
+        CMD=$ENABLE_LB
+    else
+        CMD=$DISABLE_LB
+    fi
     ;;
 Undefined)
     # shutting down database: do nothing
-- 
GitLab