summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorNirbhay Choubey <nirbhay@mariadb.com>2015-11-16 12:35:06 -0500
committerNirbhay Choubey <nirbhay@mariadb.com>2015-11-16 12:35:06 -0500
commitc78fc8b1ea95dfab4dbf17678143d650ef645263 (patch)
treea1d3420bcad6806fbf014742cd7e3e4e5543aa8a /scripts
parentdcb7996cb7f07a8d7cafc9b564c382359b412fe2 (diff)
downloadmariadb-git-c78fc8b1ea95dfab4dbf17678143d650ef645263.tar.gz
MTR: rsync process is left running if pid file is removed
MTR drops the datadir in the event of a test failure. In case mysqld is running as a Galera node and a failure occurs while the SST is in progress, the rsync pid file gets removed as part of the cleanup and wsrep_sst_rsync, which relies on this file, fails to kill the rsync. Fixed by using the cached $RSYNC_REAL_PID to kill rsync daemon.
Diffstat (limited to 'scripts')
-rw-r--r--scripts/wsrep_sst_rsync.sh17
1 files changed, 11 insertions, 6 deletions
diff --git a/scripts/wsrep_sst_rsync.sh b/scripts/wsrep_sst_rsync.sh
index b3a07f8bbf6..6d8181a0b14 100644
--- a/scripts/wsrep_sst_rsync.sh
+++ b/scripts/wsrep_sst_rsync.sh
@@ -18,8 +18,10 @@
# This is a reference script for rsync-based state snapshot tansfer
-RSYNC_PID=
-RSYNC_CONF=
+RSYNC_PID= # rsync pid file
+RSYNC_CONF= # rsync configuration file
+RSYNC_REAL_PID= # rsync process id
+
OS=$(uname)
[ "$OS" == "Darwin" ] && export -n LD_LIBRARY_PATH
@@ -32,10 +34,12 @@ wsrep_check_programs rsync
cleanup_joiner()
{
- local PID=$(cat "$RSYNC_PID" 2>/dev/null || echo 0)
- wsrep_log_info "Joiner cleanup. rsync PID: $PID"
- [ "0" != "$PID" ] && kill $PID && sleep 0.5 && kill -9 $PID >/dev/null 2>&1 \
- || :
+ wsrep_log_info "Joiner cleanup. rsync PID: $RSYNC_REAL_PID"
+ [ "0" != "$RSYNC_REAL_PID" ] && \
+ kill $RSYNC_REAL_PID && \
+ sleep 0.5 && \
+ kill -9 $RSYNC_REAL_PID >/dev/null 2>&1 || \
+ :
rm -rf "$RSYNC_CONF"
rm -rf "$MAGIC_FILE"
rm -rf "$RSYNC_PID"
@@ -45,6 +49,7 @@ cleanup_joiner()
fi
}
+# Check whether rsync process is still running.
check_pid()
{
local pid_file=$1