Put the restored PostgreSQL socket on a short path

Why: The restored postmaster refused to start because the results-directory socket path exceeded the 107-byte Unix socket limit.
Evidence: restore/postgres.log from backup-20261012-150713 says the socket path is too long (SELF). bash -n passed.
Impact: The restored instance listens on /tmp/u7bk-18997, and cleanup removes that directory.
Refs: feature/u7-ops-drills
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-10-12 15:17:20 +00:00
co-authored by Cursor
parent 32ba231b04
commit 205b30e24d
+4 -2
View File
@@ -57,6 +57,7 @@ cleanup() {
"$PG_CTL" -D "$RESTORE_PG" stop -m fast >/dev/null 2>&1 || true
rm -rf "$RESTORE_PG"
fi
rm -rf /tmp/u7bk-18997
if [[ -n "$ASIDE" && -d "$ASIDE" ]]; then rm -rf "$ASIDE"; fi
if [[ "$OWNED" -eq 1 ]]; then ops_pg_remove "$ROOT" "$NAME" || true; fi
exit "$ec"
@@ -210,7 +211,8 @@ ops_kill_checked "$APP_PIDFILE" "127.0.0.1:$APP_PORT" TERM || true
echo "[backup] restore to new data directory on $RESTORE_PG_PORT"
RESTORE_PG="$RESULTS/restore/pgdata"
mkdir -p "$RESTORE_PG" "$RESULTS/restore/sock"
mkdir -p "$RESTORE_PG" /tmp/u7bk-18997
chmod 700 /tmp/u7bk-18997
cp -a "$BASE/." "$RESTORE_PG/"
cat >>"$RESTORE_PG/postgresql.auto.conf" <<EOF
archive_mode = 'off'
@@ -220,7 +222,7 @@ rm -f "$RESTORE_PG/postmaster.pid" "$RESTORE_PG/standby.signal"
touch "$RESTORE_PG/recovery.signal"
chmod 700 "$RESTORE_PG"
"$PG_CTL" -D "$RESTORE_PG" -l "$RESULTS/restore/postgres.log" -t 600 -w \
-o "-p ${RESTORE_PG_PORT} -k ${RESULTS}/restore/sock" start
-o "-p ${RESTORE_PG_PORT} -k /tmp/u7bk-18997" start
export PGPORT="$RESTORE_PG_PORT"
recovered=0
for _ in $(seq 1 300); do