From 9c3244f87eb186e04406bfae3f7969dbc968b062 Mon Sep 17 00:00:00 2001 From: Marco Giacomassi Date: Thu, 17 May 2018 21:12:49 +0200 Subject: [PATCH] [Incubator/mysqlha] rechedule fails with persistent disks (#5523) * STOP SLAVE IO_THREAD before changing master in xtrabackup container * Remove slave existing data before cloning * incremented chart version * fix typo --- incubator/mysqlha/Chart.yaml | 2 +- incubator/mysqlha/templates/statefulset.yaml | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/incubator/mysqlha/Chart.yaml b/incubator/mysqlha/Chart.yaml index 9a03df8d7a..718a321284 100644 --- a/incubator/mysqlha/Chart.yaml +++ b/incubator/mysqlha/Chart.yaml @@ -1,5 +1,5 @@ name: mysqlha -version: 0.2.0 +version: 0.2.1 appVersion: 5.7.13 description: MySQL cluster with a single master and zero or more slave replicas keywords: diff --git a/incubator/mysqlha/templates/statefulset.yaml b/incubator/mysqlha/templates/statefulset.yaml index 65d5009d5b..6401d3b13c 100644 --- a/incubator/mysqlha/templates/statefulset.yaml +++ b/incubator/mysqlha/templates/statefulset.yaml @@ -23,12 +23,14 @@ spec: - "-c" - | set -ex - # Skip the clone if data already exists. - [[ -d /var/lib/mysql/mysql ]] && exit 0 # Skip the clone on master (ordinal index 0). [[ `hostname` =~ -([0-9]+)$ ]] || exit 1 ordinal=${BASH_REMATCH[1]} [[ $ordinal -eq 0 ]] && exit 0 + + # If data already exists, delete and proceed to clone. + [[ -d /var/lib/mysql/mysql ]] && rm -fr /var/lib/mysql/* + # Clone data from previous peer. ncat --recv-only {{ template "fullname" . }}-$(($ordinal-1)).{{ template "fullname" . }} 3307 | xbstream -x -C /var/lib/mysql # Prepare the backup. @@ -191,6 +193,7 @@ spec: # In case of container restart, attempt this at-most-once. cp change_master_to.sql.in change_master_to.sql.orig mysql -h 127.0.0.1 --verbose<