Prepare MariaDB restore tests and recover backup disk space safely

This commit is contained in:
admin committed 2026-09-12 20:36:18 +02:00
1 parent f0c761213d
commit b0416461bc
23 files changed
+918 -129

No files matched your search

+12
View File
@@ -7,6 +7,18 @@ source "$LIB_DIR/common.sh"
CONFIG_FILE=${1:?Missing config}
shift
load_config
if [[ ${1:-} == space ]]; then
# Local maintenance requested between components, while the parent holds FD 9.
[[ /proc/$PPID/fd/9 -ef $LOCKFILE ]] || die 'Space recovery requires the parent backup lock'
[[ ${2:-} =~ ^[0-9]+$ && $# == 2 ]] || die 'Invalid space request'
guard_workspaces
# shellcheck source=lib/space.sh
source "$LIB_DIR/space.sh"
clean_backup_scratch
MIN_FREE_GB=$(python3 -c 'import math,sys; print(math.ceil(float(sys.argv[1])))' "$RESTORE_TEST_MIN_FREE_GB")
ensure_space "$WORKDIR" "$2"
exit 0
fi
check_remote >&2
# rclone is restricted to read operations here, including metadata reads.
case ${1:-} in lsf|cat) rc "$@" ;; *) die 'Unsupported restore-test remote operation' ;; esac