diff options
author | Sachin Setiya <sachinsetia1001@gmail.com> | 2017-12-20 00:06:02 +0530 |
---|---|---|
committer | Sachin Setiya <sachinsetia1001@gmail.com> | 2017-12-20 00:06:02 +0530 |
commit | 9007ca68738cb11b24854aa1bfa12dcd204a459d (patch) | |
tree | bace82be8ef24bce0f272ca4d8a93527af8c54d4 /sql/hostname.h | |
parent | e6e026ae51a77969749de201d491a176483bbc69 (diff) | |
download | mariadb-git-9007ca68738cb11b24854aa1bfa12dcd204a459d.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 'sql/hostname.h')
0 files changed, 0 insertions, 0 deletions