File tree Expand file tree Collapse file tree
ansible/files/admin_api_scripts/pg_upgrade_scripts Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -430,9 +430,10 @@ EXTRA_NIX_CONF
430430
431431 log " Store path: $STORE_PATH "
432432
433- # Realize the closure from the binary cache.
433+ # Realize the closure from the binary cache and root it in the pg-upgrade
434+ # profile, so a GC can't remove it mid-upgrade.
434435 #
435- # nix-store -r can stall indefinitely on a dropped S3 connection without
436+ # The fetch can stall indefinitely on a dropped S3 connection without
436437 # erroring out (its own download timeout doesn't reliably fire), so guard each
437438 # attempt with a timeout and retry. Each path downloads atomically: already-
438439 # registered paths are skipped on retry but an in-flight NAR restarts from
@@ -447,14 +448,14 @@ EXTRA_NIX_CONF
447448
448449 nix_store_ok=" false"
449450 for attempt in 1 2 3; do
450- if timeout -k 10s 120s nix-store -r --quiet " $STORE_PATH " ; then
451+ if timeout -k 10s 120s nix-env --option stalled-download-timeout 60 --profile /nix/var/nix/profiles/pg-upgrade --set " $STORE_PATH " ; then
451452 nix_store_ok=" true"
452453 break
453454 fi
454455 if [ " $attempt " -lt 3 ]; then
455- log " WARNING: nix-store -r attempt ${attempt} /3 for $STORE_PATH failed or stalled (>=120s + up to 10s kill grace); retrying"
456+ log " WARNING: nix-env --set attempt ${attempt} /3 for $STORE_PATH failed or stalled (>=120s + up to 10s kill grace); retrying"
456457 else
457- log " ERROR: nix-store -r failed after 3 attempts for $STORE_PATH "
458+ log " ERROR: nix-env --set failed after 3 attempts for $STORE_PATH "
458459 fi
459460 done
460461 [ " $nix_store_ok " = " true" ]
You can’t perform that action at this time.
0 commit comments