Skip to content
This repository has been archived by the owner on Dec 13, 2022. It is now read-only.

fix(bug): partial backup didn't backup the right partition for data_bin and logs #7242

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions cron/centreon-backup-mysql.sh
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,9 @@ $INIT_SCRIPT start
###
output_log "Mount LVM snapshot"
mkdir -p "$SNAPSHOT_MOUNT"
mount /dev/$vg_name/dbbackup "$SNAPSHOT_MOUNT"
TYPEFS_BACKUP=$(df -T "$datadir" | tail -1 | awk -F' ' '{print $(NF-5)}')
[ "$TYPEFS_BACKUP" = "xfs" ] && MNTOPTIONS="-o nouuid"
mount $MNTOPTIONS /dev/$vg_name/dbbackup "$SNAPSHOT_MOUNT"
if [ $? -eq 0 ]; then
output_log "Device mounted successfully"
else
Expand All @@ -253,12 +255,13 @@ concat_datadir=$(echo "$datadir" | sed "s#^${mount_point}##")
ar_exclude_file=""
last_save_time=$(cat "$SAVE_LAST_DIR/$SAVE_LAST_FILE")

if [ $OPT_PARTIAL -eq 1 ] ; then
if [ $OPT_PARTIAL -eq 1 ] && [ -n "$last_save_time" ] ; then
minutes=$((($save_timestamp - $last_save_time) / 60))
for table in $PARTITION_NAME ; do
tmp_dir=$(dirname "$table")
tmp_name=$(basename "$table")
tmp_path=$(echo "$SNAPSHOT_MOUNT/$concat_datadir/$tmp_dir" | sed "s#/\+#/#g")
for tmp_file in $(find "$tmp_path" -name "$tmp_name*" -type f); do
for tmp_file in $(find "$tmp_path" -name "$tmp_name*" -mmin +$minutes -type f); do
ar_exclude_file="$ar_exclude_file \"$tmp_file\""
done
done
Expand Down