Skip to content

Commit f2b67a5

Browse files
author
Sven Speckmaier
committed
copy incremental backup before using
1 parent e2b8bd9 commit f2b67a5

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

entrypoint

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,7 @@ restore_incremental() {
352352
local BACKUP_NAME="$2"
353353
local RESTORE_DIRECTORY="$3"
354354
local BACKUP_PATH="${BACKUP_DIRECTORY}/${BACKUP_NAME}"
355+
local TEMPORARY_BACKUP_PATH="/tmp/${BACKUP_NAME}"
355356

356357
echo "======================================================================"
357358
echo "= Incremental full backup ${BACKUP_PATH}"
@@ -372,13 +373,16 @@ restore_incremental() {
372373
echo "Copying full backup"
373374
cp -Rfv "${BASE_BACKUP_PATH}" "${RESTORE_DIRECTORY}"
374375

376+
echo "Copying incremental Backup"
377+
cp -Rfv "${BACKUP_PATH}" "${TEMPORARY_BACKUP_PATH}"
378+
375379
# Prepare the full backup
376380
echo "Preparing ${BASE_BACKUP_NAME}"
377381
xtrabackup --prepare --apply-log-only --target-dir="$RESTORE_DIRECTORY"
378382

379383
# apply the incremental backup
380384
echo "Preparing ${BACKUP_NAME}"
381-
xtrabackup --prepare --target-dir="$RESTORE_DIRECTORY" --incremental-dir="${BACKUP_PATH}"
385+
xtrabackup --prepare --target-dir="$RESTORE_DIRECTORY" --incremental-dir="${TEMPORARY_BACKUP_PATH}"
382386

383387
echo "Done preparing"
384388
# copying back the prepared directory to the data directory is done in restore() as it is a shared step

0 commit comments

Comments
 (0)