Skip to content

Commit

Permalink
fix: mongodb restore failed for datafile backup (#5647)
Browse files Browse the repository at this point in the history
  • Loading branch information
wangyelei authored Oct 27, 2023
1 parent 30de1ec commit 1968057
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion deploy/mongodb/dataprotection/datafile-backup.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
set -e
set -o pipefail
export PATH="$PATH:$DP_DATASAFED_BIN_PATH"
export DATASAFED_BACKEND_BASE_PATH="$DP_BACKUP_BASE_PATH"
trap handle_exit EXIT
cd ${DATA_DIR}
START_TIME=$(get_current_time)
# TODO: flush data and locked write, otherwise data maybe inconsistent
# NOTE: if files changed during taring, the exit code will be 1 when it ends.
tar -czvf - ./ | datasafed push - "${DP_BACKUP_NAME}.tar.gz"
rm -rf mongodb.backup
# stat and save the backup information
Expand Down
2 changes: 1 addition & 1 deletion deploy/mongodb/dataprotection/datafile-restore.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ set -o pipefail
export PATH="$PATH:$DP_DATASAFED_BIN_PATH"
export DATASAFED_BACKEND_BASE_PATH="$DP_BACKUP_BASE_PATH"
mkdir -p ${DATA_DIR}
res=`ls -A ${DATA_DIR}`
res=`find ${DATA_DIR} -type f`
data_protection_file=${DATA_DIR}/.kb-data-protection
if [ ! -z "${res}" ] && [ ! -f ${data_protection_file} ]; then
echo "${DATA_DIR} is not empty! Please make sure that the directory is empty before restoring the backup."
Expand Down
2 changes: 1 addition & 1 deletion deploy/qdrant/scripts/qdrant-restore.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set -o pipefail
export PATH="$PATH:$DP_DATASAFED_BIN_PATH"
export DATASAFED_BACKEND_BASE_PATH="$DP_BACKUP_BASE_PATH"
mkdir -p ${DATA_DIR}
res=`ls -A ${DATA_DIR}`
res=`find ${DATA_DIR} -type f`
if [ ! -z "${res}" ]; then
echo "${DATA_DIR} is not empty! Please make sure that the directory is empty before restoring the backup."
exit 1
Expand Down
2 changes: 1 addition & 1 deletion deploy/redis/dataprotection/backup.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
set -e
set -o pipefail

# if the script exits with a non-zero exit code, touch a file to indicate that the backup failed,
Expand Down Expand Up @@ -29,6 +28,7 @@ while true; do
done
echo "INFO: start to save data file..."
cd ${DATA_DIR}
# NOTE: if files changed during taring, the exit code will be 1 when it ends.
tar -czvf - ./ | datasafed push - "${DP_BACKUP_NAME}.tar.gz"
echo "INFO: save data file successfully"
TOTAL_SIZE=$(datasafed stat / | grep TotalSize | awk '{print $2}')
Expand Down

0 comments on commit 1968057

Please sign in to comment.