Skip to content

Commit 541e30f

Browse files
committed
fix bugs in mariadb image
1 parent 55147b8 commit 541e30f

1 file changed

Lines changed: 15 additions & 10 deletions

File tree

mariadb-logical-backup/mariadb-dump.sh

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,23 @@ function dump {
3030
# --single-transaction: Ensure consistency for InnoDB without locking
3131
# --quick: Stream output to save memory
3232
# --routines: Include stored procedures
33-
mariadb-dump -h "$MARIADB_HOST" -u "$MARIADB_USER" -p"$MARIADB_PASSWORD" -P "$MARIADB_PORT" "$MARIADB_DATABASE" \
34-
--single-transaction \
35-
--quick \
36-
--routines \
37-
--events \
38-
--skip-ssl \
39-
--insert-ignore \
40-
--verbose
33+
mariadb-dump -h "$MARIADB_HOST" -u "$MARIADB_USER" -p"$MARIADB_PASSWORD" -P "$MARIADB_PORT" \
34+
--single-transaction \
35+
--quick \
36+
--routines \
37+
--events \
38+
--skip-ssl \
39+
--insert-ignore \
40+
--verbose \
41+
"$MARIADB_DATABASE"
4142
}
4243

4344
function compress {
44-
# Use pigz for multi-threaded compression if available, else gzip
45-
pigz
45+
if command -v pigz &> /dev/null; then
46+
pigz
47+
else
48+
gzip
49+
fi
4650
}
4751

4852
function az_upload {
@@ -132,5 +136,6 @@ else
132136
# Stream dump directly to S3 to save disk space
133137
dump | compress | upload
134138
[[ ${PIPESTATUS[0]} != 0 || ${PIPESTATUS[1]} != 0 || ${PIPESTATUS[2]} != 0 ]] && (( ERRORCOUNT += 1 ))
139+
set +x
135140
exit $ERRORCOUNT
136141
fi

0 commit comments

Comments
 (0)