restore: gate offload on SLOWDISK=true (exact) with --no-slowdisk override
Use the single SLOWDISK env var from .env (already set to "true" on the dedicated-extra-disk hosts, e.g. us-35). Offload runs only when SLOWDISK is exactly the literal "true" (case matters) and the --no-slowdisk flag was not passed. --no-slowdisk forces it off even when SLOWDISK=true (extra disk full). Replaces the prior NO_SLOWDISK inversion. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -14,13 +14,12 @@ for _a in "$@"; do
|
|||||||
done
|
done
|
||||||
set -- "${_pos[@]}"
|
set -- "${_pos[@]}"
|
||||||
|
|
||||||
# Static-file offload gate. NO_SLOWDISK defaults to TRUE (offload OFF). A host with a real
|
# Static-file offload gate. Hosts with a real dedicated extra disk mounted at /slowdisk set
|
||||||
# dedicated extra disk mounted at /slowdisk sets NO_SLOWDISK=false in its .env to ENABLE the
|
# SLOWDISK=true in their .env; that (and only the literal "true") enables the offload. The
|
||||||
# offload. The --no-slowdisk flag forces it back to true (e.g. the extra disk is full),
|
# --no-slowdisk flag disables it even when SLOWDISK=true (e.g. the extra disk is full).
|
||||||
# overriding the .env value.
|
|
||||||
[ -f "$dir/.env" ] && source "$dir/.env"
|
[ -f "$dir/.env" ] && source "$dir/.env"
|
||||||
NO_SLOWDISK="${NO_SLOWDISK:-true}"
|
SLOWDISK="${SLOWDISK:-}"
|
||||||
[ "$no_slowdisk_flag" = 1 ] && NO_SLOWDISK=true
|
[ "$no_slowdisk_flag" = 1 ] && SLOWDISK=false
|
||||||
|
|
||||||
remote_source="$2"
|
remote_source="$2"
|
||||||
if [[ -n "$remote_source" ]] && is_local_backup_url "$remote_source"; then
|
if [[ -n "$remote_source" ]] && is_local_backup_url "$remote_source"; then
|
||||||
@@ -44,16 +43,13 @@ fi
|
|||||||
# hot/dynamic state stays on the primary disk. tar then extracts THROUGH the symlinks via
|
# hot/dynamic state stays on the primary disk. tar then extracts THROUGH the symlinks via
|
||||||
# --keep-directory-symlink (it keeps the dir-symlinks instead of clobbering them).
|
# --keep-directory-symlink (it keeps the dir-symlinks instead of clobbering them).
|
||||||
# Target naming matches delete-volumes.sh / delete_slowdisk_targets_for_key cleanup.
|
# Target naming matches delete-volumes.sh / delete_slowdisk_targets_for_key cleanup.
|
||||||
# GATED on NO_SLOWDISK (see top): offload runs only when NO_SLOWDISK=false (host has a real
|
# GATED on SLOWDISK (see top): offload runs only when SLOWDISK is exactly "true" (set in the
|
||||||
# dedicated extra disk; set in .env) and the --no-slowdisk flag was not passed. Safe fallbacks
|
# host .env on dedicated-extra-disk hosts) and the --no-slowdisk flag was not passed. Case
|
||||||
# (just extract normally): NO_SLOWDISK true, /slowdisk missing, no manifest, or no static paths.
|
# matters — only the literal lowercase "true" enables it. Safe fallbacks (normal extract):
|
||||||
# (/slowdisk is the fixed in-container mount, so the target path is fixed.)
|
# SLOWDISK not "true", /slowdisk missing, no manifest, or no static paths.
|
||||||
prep_static_offload() {
|
prep_static_offload() {
|
||||||
local key=$1 meta=$2 data_dir=$3 rel target
|
local key=$1 meta=$2 data_dir=$3 rel target
|
||||||
case "${NO_SLOWDISK,,}" in
|
[ "$SLOWDISK" = "true" ] || { echo " static offload disabled (SLOWDISK=$SLOWDISK) — normal extract"; return 0; }
|
||||||
false|0|no|off) ;; # offload enabled
|
|
||||||
*) echo " static offload disabled (NO_SLOWDISK=$NO_SLOWDISK) — normal extract"; return 0 ;;
|
|
||||||
esac
|
|
||||||
[ -d /slowdisk ] || { echo " /slowdisk absent — no static offload"; return 0; }
|
[ -d /slowdisk ] || { echo " /slowdisk absent — no static offload"; return 0; }
|
||||||
[ -f "$meta" ] || { echo " no manifest ($meta) — no static offload"; return 0; }
|
[ -f "$meta" ] || { echo " no manifest ($meta) — no static offload"; return 0; }
|
||||||
# manifest data lines (after the 3-line header) are "<size> <relpath>"
|
# manifest data lines (after the 3-line header) are "<size> <relpath>"
|
||||||
|
|||||||
Reference in New Issue
Block a user