File tree Expand file tree Collapse file tree 3 files changed +28
-6
lines changed Expand file tree Collapse file tree 3 files changed +28
-6
lines changed Original file line number Diff line number Diff line change @@ -6,23 +6,31 @@ set -o pipefail
6
6
# Execute a full backup
7
7
backup_full () {
8
8
echo " Taking a full backup"
9
+ LAST_FULL_DATE=$( date +%d-%m-%Y)
9
10
mariabackup \
10
11
--defaults-file=/etc/mysql/my.cnf \
11
12
--backup \
12
13
--stream=xbstream \
13
- --history=$( date +%d-%m-%Y ) | gzip > \
14
+ --history=$LAST_FULL_DATE | gzip > \
14
15
$BACKUP_DIR /mysqlbackup-$( date +%d-%m-%Y-%s) .qp.xbc.xbs.gz
16
+ echo $LAST_FULL_DATE > $BACKUP_DIR /last_full_date
15
17
}
16
18
17
19
# Execute an incremental backup
18
20
backup_incremental () {
19
21
echo " Taking an incremental backup"
22
+ if [ -r $BACKUP_DIR /last_full_date ]; then
23
+ LAST_FULL_DATE=$( cat $BACKUP_DIR /last_full_date)
24
+ fi
25
+ if [ -z $LAST_FULL_DATE ]; then
26
+ LAST_FULL_DATE=$( date +%d-%m-%Y)
27
+ fi
20
28
mariabackup \
21
29
--defaults-file=/etc/mysql/my.cnf \
22
30
--backup \
23
31
--stream=xbstream \
24
- --incremental-history-name=$( date +%d-%m-%Y ) \
25
- --history=$( date +%d-%m-%Y ) | gzip > \
32
+ --incremental-history-name=$LAST_FULL_DATE \
33
+ --history=$LAST_FULL_DATE | gzip > \
26
34
$BACKUP_DIR /incremental-$( date +%H) -mysqlbackup-$( date +%d-%m-%Y-%s) .qp.xbc.xbs.gz
27
35
}
28
36
Original file line number Diff line number Diff line change @@ -6,23 +6,31 @@ set -o pipefail
6
6
# Execute a full backup
7
7
backup_full () {
8
8
echo " Taking a full backup"
9
+ LAST_FULL_DATE=$( date +%d-%m-%Y)
9
10
mariabackup \
10
11
--defaults-file=/etc/mysql/my.cnf \
11
12
--backup \
12
13
--stream=xbstream \
13
- --history=$( date +%d-%m-%Y ) | gzip > \
14
+ --history=$LAST_FULL_DATE | gzip > \
14
15
$BACKUP_DIR /mysqlbackup-$( date +%d-%m-%Y-%s) .qp.xbc.xbs.gz
16
+ echo $LAST_FULL_DATE > $BACKUP_DIR /last_full_date
15
17
}
16
18
17
19
# Execute an incremental backup
18
20
backup_incremental () {
19
21
echo " Taking an incremental backup"
22
+ if [ -r $BACKUP_DIR /last_full_date ]; then
23
+ LAST_FULL_DATE=$( cat $BACKUP_DIR /last_full_date)
24
+ fi
25
+ if [ -z $LAST_FULL_DATE ]; then
26
+ LAST_FULL_DATE=$( date +%d-%m-%Y)
27
+ fi
20
28
mariabackup \
21
29
--defaults-file=/etc/mysql/my.cnf \
22
30
--backup \
23
31
--stream=xbstream \
24
- --incremental-history-name=$( date +%d-%m-%Y ) \
25
- --history=$( date +%d-%m-%Y ) | gzip > \
32
+ --incremental-history-name=$LAST_FULL_DATE \
33
+ --history=$LAST_FULL_DATE | gzip > \
26
34
$BACKUP_DIR /incremental-$( date +%H) -mysqlbackup-$( date +%d-%m-%Y-%s) .qp.xbc.xbs.gz
27
35
}
28
36
Original file line number Diff line number Diff line change
1
+ ---
2
+ fixes :
3
+ - |
4
+ Fixes MariaDB incremental backup failure when full
5
+ backup was not created the same day.
6
+ `LP#1897948 <https://launchpad.net/bugs/1897948>`__
You can’t perform that action at this time.
0 commit comments