summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorSachin Setiya <sachinsetia1001@gmail.com>2017-12-20 00:06:02 +0530
committerSergei Golubchik <serg@mariadb.org>2017-12-20 18:51:30 +0100
commit2a4faa8ab61bd508e6fa5a477853d0ddeed94fcc (patch)
tree5445d60e14342753ec90f88abced3ce03042fde8 /scripts
parent353fe8a321625b696dd5bb5f680a978510a9dcc2 (diff)
downloadmariadb-git-2a4faa8ab61bd508e6fa5a477853d0ddeed94fcc.tar.gz
MDEV-13478 Full SST sync fails because of the error in the cleaning part
Problem: The command was: find $paths -mindepth 1 -regex $cpat -prune -o -exec rm -rf {} \+ Which was supposed to work as * skipping $paths directories themselves (-mindepth 1) * see if the dir/file name matches $cpat (-regex) * if yes - don't dive into the directory, skip it (-prune) * otherwise (-o) * remove it and everything inside (-exec) Now -exec ... \+ works like this: every new found path is appended to the end of the command line. when accumulated command line length reaches `getconf ARG_MAX` (~2Gb) it's executed, and find continues, appending to a new command line. What happens here, find appends some directory to the command line, then dives into it, and starts appending files from that directory. At some point command line overflows, rm -rf gets executed and removes the whole directory. Now find tries to continue scanning the directory that was already removed. Fix: don't dive into directories that will be recursively removed anyway, use -prune for them. Basically, we should be pruning both paths that have matched $cpat and paths that have not matched it. This is achived by pruning unconditionally, before the regex is tested: find $paths -mindepth 1 -prune -regex $cpat -o -exec rm -rf {} \+ Patch Credit:- Serg
Diffstat (limited to 'scripts')
-rw-r--r--scripts/wsrep_sst_xtrabackup-v2.sh2
1 files changed, 1 insertions, 1 deletions
diff --git a/scripts/wsrep_sst_xtrabackup-v2.sh b/scripts/wsrep_sst_xtrabackup-v2.sh
index 40e686d4d6b..9284bf78019 100644
--- a/scripts/wsrep_sst_xtrabackup-v2.sh
+++ b/scripts/wsrep_sst_xtrabackup-v2.sh
@@ -1072,7 +1072,7 @@ then
wsrep_log_info "Cleaning the existing datadir and innodb-data/log directories"
- find $ib_home_dir $ib_log_dir $ib_undo_dir $DATA -mindepth 1 -regex $cpat -prune -o -exec rm -rfv {} 1>&2 \+
+ find $ib_home_dir $ib_log_dir $ib_undo_dir $DATA -mindepth 1 -prune -regex $cpat -o -exec rm -rfv {} 1>&2 \+
tempdir=$(parse_cnf mysqld log-bin "")
if [[ -n ${tempdir:-} ]];then