From 6c110c08eda38fe08a41fcee1bfebf6a2c7094f0 Mon Sep 17 00:00:00 2001 From: Claude Agent Date: Mon, 15 Jun 2026 04:50:06 +0000 Subject: [PATCH] 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) --- restore-volumes.sh | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/restore-volumes.sh b/restore-volumes.sh index 0d2bdb3d..45ced8b3 100755 --- a/restore-volumes.sh +++ b/restore-volumes.sh @@ -14,13 +14,12 @@ for _a in "$@"; do done set -- "${_pos[@]}" -# Static-file offload gate. NO_SLOWDISK defaults to TRUE (offload OFF). A host with a real -# dedicated extra disk mounted at /slowdisk sets NO_SLOWDISK=false in its .env to ENABLE the -# offload. The --no-slowdisk flag forces it back to true (e.g. the extra disk is full), -# overriding the .env value. +# Static-file offload gate. Hosts with a real dedicated extra disk mounted at /slowdisk set +# SLOWDISK=true in their .env; that (and only the literal "true") enables the offload. The +# --no-slowdisk flag disables it even when SLOWDISK=true (e.g. the extra disk is full). [ -f "$dir/.env" ] && source "$dir/.env" -NO_SLOWDISK="${NO_SLOWDISK:-true}" -[ "$no_slowdisk_flag" = 1 ] && NO_SLOWDISK=true +SLOWDISK="${SLOWDISK:-}" +[ "$no_slowdisk_flag" = 1 ] && SLOWDISK=false remote_source="$2" 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 # --keep-directory-symlink (it keeps the dir-symlinks instead of clobbering them). # 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 -# dedicated extra disk; set in .env) and the --no-slowdisk flag was not passed. Safe fallbacks -# (just extract normally): NO_SLOWDISK true, /slowdisk missing, no manifest, or no static paths. -# (/slowdisk is the fixed in-container mount, so the target path is fixed.) +# GATED on SLOWDISK (see top): offload runs only when SLOWDISK is exactly "true" (set in the +# host .env on dedicated-extra-disk hosts) and the --no-slowdisk flag was not passed. Case +# matters — only the literal lowercase "true" enables it. Safe fallbacks (normal extract): +# SLOWDISK not "true", /slowdisk missing, no manifest, or no static paths. prep_static_offload() { local key=$1 meta=$2 data_dir=$3 rel target - case "${NO_SLOWDISK,,}" in - false|0|no|off) ;; # offload enabled - *) echo " static offload disabled (NO_SLOWDISK=$NO_SLOWDISK) — normal extract"; return 0 ;; - esac + [ "$SLOWDISK" = "true" ] || { echo " static offload disabled (SLOWDISK=$SLOWDISK) — normal extract"; return 0; } [ -d /slowdisk ] || { echo " /slowdisk absent — 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 " "