Add --rsync option for backup script
Adjust condition for throttle option
PROD-32205
Change-Id: If59e9db3b7f13f327e21b1eae25e53deddcf5e31
diff --git a/README.rst b/README.rst
index 101134e..d4137ff 100644
--- a/README.rst
+++ b/README.rst
@@ -79,6 +79,7 @@
hours_before_full: 48
hours_before_incr: 12
compression: true
+ rsync_tables: true
compression_threads: 2
throttle: 20
database:
@@ -111,6 +112,7 @@
hour: 4
minute: 52
compression: true
+ rsync_tables: true
compression_threads: 2
database:
user: user
@@ -222,6 +224,7 @@
restore_full_latest: 1
restore_from: local
compression: true
+ rsync_tables: true
compressThreads: 2
database:
user: username
@@ -249,6 +252,7 @@
restore_full_latest: 1
restore_from: remote
compression: true
+ rsync_tables: true
compressThreads: 2
database:
user: username
diff --git a/metadata/service/client/single.yml b/metadata/service/client/single.yml
index c6edea0..4406a84 100644
--- a/metadata/service/client/single.yml
+++ b/metadata/service/client/single.yml
@@ -14,6 +14,7 @@
hours_before_full: 48
hours_before_incr: 12
compression: true
+ rsync_tables: true
compression_threads: 2
database:
user: root
diff --git a/tests/pillar/client.sls b/tests/pillar/client.sls
index 38c47d1..293025b 100644
--- a/tests/pillar/client.sls
+++ b/tests/pillar/client.sls
@@ -5,6 +5,7 @@
hours_before_full: 48
hours_before_incr: 12
compression: true
+ rsync_tables: true
compression_threads: 2
throttle: 20
database:
diff --git a/tests/pillar/client_backup_times.sls b/tests/pillar/client_backup_times.sls
index e4cd6b0..ac29f9b 100644
--- a/tests/pillar/client_backup_times.sls
+++ b/tests/pillar/client_backup_times.sls
@@ -11,6 +11,7 @@
hour: 4
minute: 52
compression: true
+ rsync_tables: true
compression_threads: 2
database:
user: user
diff --git a/tests/pillar/client_using_tcp.sls b/tests/pillar/client_using_tcp.sls
index b8c05dd..5092a1d 100644
--- a/tests/pillar/client_using_tcp.sls
+++ b/tests/pillar/client_using_tcp.sls
@@ -5,6 +5,7 @@
hours_before_full: 48
hours_before_incr: 12
compression: true
+ rsync_tables: true
compression_threads: 2
throttle: 20
database:
diff --git a/xtrabackup/client/init.sls b/xtrabackup/client/init.sls
index 35c7c03..d9bb118 100644
--- a/xtrabackup/client/init.sls
+++ b/xtrabackup/client/init.sls
@@ -31,7 +31,7 @@
xtrabackup_client_runner_cron:
cron.present:
- - name: /usr/local/bin/innobackupex-runner.sh
+ - name: /bin/bash /usr/local/bin/innobackupex-runner.sh
- user: root
{%- if client.cron is defined %}
- commented: {{ not client.cron }}
diff --git a/xtrabackup/files/innobackupex-client-runner.sh b/xtrabackup/files/innobackupex-client-runner.sh
index f17238f..b287300 100644
--- a/xtrabackup/files/innobackupex-client-runner.sh
+++ b/xtrabackup/files/innobackupex-client-runner.sh
@@ -47,13 +47,18 @@
{%- else %}
compression="false"
{%- endif %}
+{%- if client.rsync_tables is defined %}
+rsyncTables="--rsync"
+{%- else %}
+rsyncTables=""
+{%- endif %}
{%- if client.compression_threads is defined %}
compression_threads="{{ client.compression_threads }}"
{%- else %}
compression_threads="1"
{%- endif %}
-{%- if client.throttle is defined %}
-throttle="--throttle {{ client.get('throttle', 20) }}"
+{%- if client.throttle is defined and client.throttle|int > 0 %}
+throttle="--throttle {{ client.throttle }}"
{%- else %}
throttle=""
{%- endif %}
@@ -151,10 +156,10 @@
fi
echo "Running new incremental backup using $INCRBASEDIR as base."
- innobackupex --defaults-file=$MYCNF $USEROPTIONS $throttle $compress $compression_threads --incremental $TMPINCRDIR --incremental-basedir $INCRBASEDIR 2>&1 | tee $TMPFILE
+ innobackupex --defaults-file=$MYCNF $USEROPTIONS $rsyncTables $throttle $compress $compression_threads --incremental $TMPINCRDIR --incremental-basedir $INCRBASEDIR 2>&1 | tee $TMPFILE
else
echo "Running new full backup."
- innobackupex --defaults-file=$MYCNF $USEROPTIONS $throttle $compress $compression_threads $FULLBACKUPDIR 2>&1 | tee $TMPFILE
+ innobackupex --defaults-file=$MYCNF $USEROPTIONS $rsyncTables $throttle $compress $compression_threads $FULLBACKUPDIR 2>&1 | tee $TMPFILE
fi
else
# Get number of full and incremental backups
@@ -166,7 +171,7 @@
#If number of incremental mod number of full backups to keep equals 1, run full backup, otherwise run incremental
if [ $(( ($NUMBER_OF_INCR + $NUMBER_OF_FULL) % ($INCRBEFOREFULL + 1) )) -eq 0 ] || [ "$FORCEFULL" == true ] ; then
echo "Running new full backup."
- innobackupex --defaults-file=$MYCNF $USEROPTIONS $compress $compression_threads $FULLBACKUPDIR 2>&1 | tee $TMPFILE
+ innobackupex --defaults-file=$MYCNF $USEROPTIONS $rsyncTables $compress $compression_threads $FULLBACKUPDIR 2>&1 | tee $TMPFILE
else
# Create incremental backups dir if not exists.
TMPINCRDIR=$INCRBACKUPDIR/$LATEST_FULL
@@ -183,7 +188,7 @@
fi
echo "Running new incremental backup using $INCRBASEDIR as base."
- innobackupex --defaults-file=$MYCNF $USEROPTIONS $compress $compression_threads --incremental $TMPINCRDIR --incremental-basedir $INCRBASEDIR 2>&1 | tee $TMPFILE
+ innobackupex --defaults-file=$MYCNF $USEROPTIONS $rsyncTables $compress $compression_threads --incremental $TMPINCRDIR --incremental-basedir $INCRBASEDIR 2>&1 | tee $TMPFILE
fi
fi
if [ -z "$(tail -1 $TMPFILE | grep 'completed OK!')" ] ; then