summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authormkaruza <mario.karuza@gmail.com>2018-06-19 16:09:31 +0200
committermkaruza <mario.karuza@gmail.com>2018-06-19 16:09:31 +0200
commite5c6580178a8d660c03fe9fab09c539cedf6fb34 (patch)
tree0686a46365d1bdd7726b7a5630d71c2f78fac61d /scripts
parentf5b128dfad1f46bf73916bc9c803a7152fdd6809 (diff)
downloadmariadb-git-e5c6580178a8d660c03fe9fab09c539cedf6fb34.tar.gz
MDEV-15442 xtrabackup-v2 SST donor stuck in DONOR/DESYNCED state when joiner is killed
Monitor mysqld process and if it is terminated during sst stream kill xtrabackup-v2 script and children
Diffstat (limited to 'scripts')
-rw-r--r--scripts/wsrep_sst_xtrabackup-v2.sh23
1 files changed, 22 insertions, 1 deletions
diff --git a/scripts/wsrep_sst_xtrabackup-v2.sh b/scripts/wsrep_sst_xtrabackup-v2.sh
index 00efdaeebcf..99bbabbe9be 100644
--- a/scripts/wsrep_sst_xtrabackup-v2.sh
+++ b/scripts/wsrep_sst_xtrabackup-v2.sh
@@ -801,6 +801,27 @@ check_for_version()
fi
}
+monitor_process()
+{
+ local sst_stream_pid=$1
+
+ while true ; do
+
+ if ! ps --pid "${WSREP_SST_OPT_PARENT}" &>/dev/null; then
+ wsrep_log_error "Parent mysqld process (PID:${WSREP_SST_OPT_PARENT}) terminated unexpectedly."
+ kill -- -"${WSREP_SST_OPT_PARENT}"
+ exit 32
+ fi
+
+ if ! ps --pid "${sst_stream_pid}" &>/dev/null; then
+ break
+ fi
+
+ sleep 0.1
+
+ done
+}
+
if [[ ! -x `which $INNOBACKUPEX_BIN` ]];then
wsrep_log_error "innobackupex not in path: $PATH"
@@ -1102,7 +1123,7 @@ then
MAGIC_FILE="${DATA}/${INFO_FILE}"
wsrep_log_info "Waiting for SST streaming to complete!"
- wait $jpid
+ monitor_process $jpid
get_proc