Update xtrabackup scripts
* Add pissibility to pass force-non-empty-directories option
* Follow symlinks for find
Related-Prod: PROD-36049
Change-Id: If3638ef66528a995549befac4a22f3ffd4a84be4
diff --git a/README.rst b/README.rst
index d4137ff..6b04064 100644
--- a/README.rst
+++ b/README.rst
@@ -254,6 +254,7 @@
compression: true
rsync_tables: true
compressThreads: 2
+ force_non_empty_directories: true
database:
user: username
password: password
diff --git a/xtrabackup/files/innobackupex-client-restore.sh b/xtrabackup/files/innobackupex-client-restore.sh
index 501e8d9..8d1d3f0 100644
--- a/xtrabackup/files/innobackupex-client-restore.sh
+++ b/xtrabackup/files/innobackupex-client-restore.sh
@@ -11,6 +11,9 @@
{%- if client.restore_from == 'remote' %}
RESTORE_FROM_MODE="remote"
{%- endif %}
+{%- if client.force_non_empty_directories is defined %}
+FORCE_NON_EMPTY="--force-non-empty-directories"
+{%- endif %}
QPRESS_URL="{{ client.qpress.name }}"
CLIENT_TARGET_HOST="{{ client.target.host }}"
SERVERBACKUPDIR="{{ server.backup_dir }}"
@@ -182,7 +185,7 @@
check_innobackupex_error
# Apply incrementals to base backup
- for i in $(find $PARENT_DIR -mindepth 1 -maxdepth 1 -type d -printf "%P\n" | sort -n); do
+ for i in $(find -L $PARENT_DIR -mindepth 1 -maxdepth 1 -type d -printf "%P\n" | sort -n); do
echo "Applying $i to full ..."
innobackupex --defaults-file=$MYCNF --apply-log --redo-only --use-memory=$MEMORY $FULLBACKUP --incremental-dir=$PARENT_DIR/$i > $TMPFILE 2>&1 || true
check_innobackupex_error
@@ -202,7 +205,7 @@
check_innobackupex_error
echo "Restoring ..."
- innobackupex --defaults-file=$MYCNF --copy-back $FULLBACKUP > $TMPFILE 2>&1 || true
+ innobackupex --defaults-file=$MYCNF $FORCE_NON_EMPTY --copy-back $FULLBACKUP > $TMPFILE 2>&1 || true
check_innobackupex_error
chown -R mysql:mysql /var/lib/mysql
#rm -f $TMPFILE
diff --git a/xtrabackup/files/innobackupex-server-runner.sh b/xtrabackup/files/innobackupex-server-runner.sh
index d210dd6..71ae2c5 100644
--- a/xtrabackup/files/innobackupex-server-runner.sh
+++ b/xtrabackup/files/innobackupex-server-runner.sh
@@ -25,7 +25,7 @@
if [ $BACKUPTIME==false ]; then
echo "Cleanup. Keeping only $KEEP full backups and its incrementals."
AGE=$(($FULLBACKUPLIFE * $KEEP / 60))
- find $FULLBACKUPDIR -maxdepth 1 -type d -mmin +$AGE -execdir echo "removing: "$FULLBACKUPDIR/{} \; -execdir rm -rf $FULLBACKUPDIR/{} \; -execdir echo "removing: "$INCRBACKUPDIR/{} \; -execdir rm -rf $INCRBACKUPDIR/{} \;
+ find -L $FULLBACKUPDIR -maxdepth 1 -type d -mmin +$AGE -execdir echo "removing: "$FULLBACKUPDIR/{} \; -execdir rm -rf $FULLBACKUPDIR/{} \; -execdir echo "removing: "$INCRBACKUPDIR/{} \; -execdir rm -rf $INCRBACKUPDIR/{} \;
echo "completed: $(date)"
exit 0
else