aboutsummaryrefslogtreecommitdiff
path: root/docker
diff options
context:
space:
mode:
authorZuul <zuul@review.opendev.org>2020-12-17 12:19:07 +0000
committerGerrit Code Review <review@openstack.org>2020-12-17 12:19:07 +0000
commita8b6d26d27b879a0c9ac75ace215172218ee91af (patch)
treef9202279895d2a65b9af3584351a3ff8cbce653b /docker
parent0dd767c2de1bfed0edc93df3d0d845b07b6ad153 (diff)
parentccfe65b5f7fe437141f342421488c176038fddb0 (diff)
downloadkolla-a8b6d26d27b879a0c9ac75ace215172218ee91af.tar.gz
kolla-a8b6d26d27b879a0c9ac75ace215172218ee91af.zip
Merge "mariadb: Fixes incremental backup failure when full not created today"
Diffstat (limited to 'docker')
-rw-r--r--docker/mariadb/mariadb-server/backup.sh14
-rw-r--r--docker/mariadb/mariadb/backup.sh14
2 files changed, 22 insertions, 6 deletions
diff --git a/docker/mariadb/mariadb-server/backup.sh b/docker/mariadb/mariadb-server/backup.sh
index e56450171..30796fa4e 100644
--- a/docker/mariadb/mariadb-server/backup.sh
+++ b/docker/mariadb/mariadb-server/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
}
diff --git a/docker/mariadb/mariadb/backup.sh b/docker/mariadb/mariadb/backup.sh
index e56450171..30796fa4e 100644
--- a/docker/mariadb/mariadb/backup.sh
+++ b/docker/mariadb/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
}