summaryrefslogtreecommitdiff
path: root/scripts/wsrep_sst_common.sh
diff options
context:
space:
mode:
authorJulius Goryavsky <julius.goryavsky@mariadb.com>2021-06-09 03:41:37 +0200
committerJulius Goryavsky <julius.goryavsky@mariadb.com>2021-06-15 14:27:22 +0200
commit18d5be5b54b1a05e6107a1c5828d9eed9cf18636 (patch)
treea8332d06a06906e09c1e59fbd9b2c6998d8edc11 /scripts/wsrep_sst_common.sh
parent1c35a3f6fd92704d7a135a81c7752f5058aaede5 (diff)
downloadmariadb-git-18d5be5b54b1a05e6107a1c5828d9eed9cf18636.tar.gz
MDEV-25880: rsync may be mistakenly killed when overlapping SST
This commit fixes a bug was originally discovered during the galera_nbo_sst_slave mtr test for 10.6 branch. However it is relevant for all versions and can lead to intermittent SST crashes via rsync on very fast server restarts - when a new SST process (for example, after starting a new server instance) overlaps the old SST process started by the previous, already terminated server. This overlap can result in the new rsync being killed instead of the old rsync, or the pid file from the new rsync being killed, which then lead to problems.
Diffstat (limited to 'scripts/wsrep_sst_common.sh')
-rw-r--r--scripts/wsrep_sst_common.sh2
1 files changed, 1 insertions, 1 deletions
diff --git a/scripts/wsrep_sst_common.sh b/scripts/wsrep_sst_common.sh
index 05944ef6035..c2f31b2818d 100644
--- a/scripts/wsrep_sst_common.sh
+++ b/scripts/wsrep_sst_common.sh
@@ -1190,7 +1190,6 @@ trim_string()
check_pid()
{
local pid_file="$1"
- local remove=${2:-0}
if [ -r "$pid_file" ]; then
local pid=$(cat "$pid_file" 2>/dev/null)
if [ -n "$pid" ]; then
@@ -1201,6 +1200,7 @@ check_pid()
fi
fi
fi
+ local remove=${2:-0}
if [ $remove -eq 1 ]; then
rm -f "$pid_file"
fi