summaryrefslogtreecommitdiff
path: root/docker
diff options
context:
space:
mode:
authorabraden <C-Albert.Braden@charter.com>2020-10-15 19:02:43 +0000
committerMark Goddard <mark@stackhpc.com>2020-12-18 08:45:08 +0000
commitc213921fddbfca13277d88ebaa35f8f34cd4809f (patch)
treed629f88915543f61ce9ed437a9b7da489289422d /docker
parent02e5389da5fe960bda46fef19ed462aa4d306161 (diff)
downloadkolla-c213921fddbfca13277d88ebaa35f8f34cd4809f.tar.gz
kolla-c213921fddbfca13277d88ebaa35f8f34cd4809f.zip
mariadb: Fixes incremental backup failure when full not created today
backup_full() saves the history name in $BACKUP_DIR/last_full_date. backup_incremental() attempts to read from $BACKUP_DIR/last_full_date into $LAST_FULL_DATE. After the read attempt; if $LAST_FULL_DATE is zero length then $(date +%d-%m-%Y) is used. Change-Id: I4172b814d5d95ae3debbc1cf3feaeee2e2bec9bd Closes-bug: 1897948 (cherry picked from commit ccfe65b5f7fe437141f342421488c176038fddb0)
Diffstat (limited to 'docker')
-rw-r--r--docker/mariadb/backup.sh14
1 files changed, 11 insertions, 3 deletions
diff --git a/docker/mariadb/backup.sh b/docker/mariadb/backup.sh
index e56450171..30796fa4e 100644
--- a/docker/mariadb/backup.sh
+++ b/docker/mariadb/backup.sh
@@ -6,23 +6,31 @@ set -o pipefail
# Execute a full backup
backup_full() {
echo "Taking a full backup"
+ LAST_FULL_DATE=$(date +%d-%m-%Y)
mariabackup \
--defaults-file=/etc/mysql/my.cnf \
--backup \
--stream=xbstream \
- --history=$(date +%d-%m-%Y) | gzip > \
+ --history=$LAST_FULL_DATE | gzip > \
$BACKUP_DIR/mysqlbackup-$(date +%d-%m-%Y-%s).qp.xbc.xbs.gz
+ echo $LAST_FULL_DATE > $BACKUP_DIR/last_full_date
}
# Execute an incremental backup
backup_incremental() {
echo "Taking an incremental backup"
+ if [ -r $BACKUP_DIR/last_full_date ]; then
+ LAST_FULL_DATE=$(cat $BACKUP_DIR/last_full_date)
+ fi
+ if [ -z $LAST_FULL_DATE ]; then
+ LAST_FULL_DATE=$(date +%d-%m-%Y)
+ fi
mariabackup \
--defaults-file=/etc/mysql/my.cnf \
--backup \
--stream=xbstream \
- --incremental-history-name=$(date +%d-%m-%Y) \
- --history=$(date +%d-%m-%Y) | gzip > \
+ --incremental-history-name=$LAST_FULL_DATE \
+ --history=$LAST_FULL_DATE | gzip > \
$BACKUP_DIR/incremental-$(date +%H)-mysqlbackup-$(date +%d-%m-%Y-%s).qp.xbc.xbs.gz
}