#!/bin/bash
# Shared weekly-maintenance workspace lifecycle. No shell options are changed.
# Source after p4_vars and logging, then call maintenance_workspace_init.
maintenance_workspace_finish() {
local rc=$?
trap - EXIT
if [[ -n ${SDP_MAINTENANCE_WORKDIR:-} ]]; then
cd "$MAINT_DIR" || rc=1
if ! rm -rf -- "$SDP_MAINTENANCE_WORKDIR"; then
echo "ERROR: Unable to remove maintenance run directory: $SDP_MAINTENANCE_WORKDIR" >&2
rc=1
fi
fi
exec 9>&-
if declare -F _sdp_on_exit >/dev/null; then
_sdp_on_exit "$rc" || :
fi
exit "$rc"
}
maintenance_workspace_init() {
local instance=$1
local base=${P4TMP:-/p4/$instance/tmp}
local rc
mkdir -p "$base" || return $?
# The lock belongs to this open file description. The Python child and
# this shell share it, so it remains held until the shell closes fd 9.
# Kernel release on process exit avoids stale pid-file recovery guesses.
exec 9>"$base/maintenance.lock" || return $?
python3 -c 'import fcntl, sys
try:
fcntl.flock(9, fcntl.LOCK_EX | fcntl.LOCK_NB)
except BlockingIOError:
sys.exit(75)
' 9>&9
rc=$?
if (( rc != 0 )); then
exec 9>&-
if (( rc == 75 )); then
echo "Another maintenance run owns instance $instance; skipping this run."
declare -F sdp_set_status >/dev/null && sdp_set_status skipped
else
echo "ERROR: Unable to acquire the maintenance lock for instance $instance." >&2
fi
return "$rc"
fi
SDP_MAINTENANCE_WORKDIR=$(mktemp -d "$base/maintenance.XXXXXXXX") || {
rc=$?
exec 9>&-
return "$rc"
}
export SDP_MAINTENANCE_WORKDIR
trap maintenance_workspace_finish EXIT
cd "$SDP_MAINTENANCE_WORKDIR" || return $?
echo "Maintenance run directory: $SDP_MAINTENANCE_WORKDIR"
}
| # | Change | User | Description | Committed | |
|---|---|---|---|---|---|
| #1 | 34004 | Russell C. Jackson (Rusty) |
Improve SDP backup/recovery, Maintenance, logging and cloud operation. Add owned checkpoint locks, recovery-aware retention, preserved database switches, bounded cleanup and coordinated AWS/Azure snapshots. Fix service-user password initialization, edge staging, standby promotion state parsing, proxy cache setup, typed depot verification and historical-server configuration/error handling. Remove unused OTP programs; keep Windows removed, server.locks cleanup and the journal-count condition unchanged. Add no global shell strict modes. Update operational documentation and add reproducible mkdirs.sh/mkdirs.cfg container assurance. Validate Ubuntu 26.04 and UBI 8.10/9.8/10.2 across both Python runtimes: 44 stages; 428 offline tests per runtime/OS, zero offline skips; 19 deployed-archive comparisons per combination. Three six-node topology runs pass all 30 recovery/failure scenarios. P4D 2023.1 through 2026.1 on UBI 8/9 pass all 14 cells and 98 scenarios. Static, documentation and provenance checks pass. Containers do not certify every fleet kernel, patch build or integration. Tested source manifest SHA-256: e1a23e17b8ced8c1148d9a250589977c6f6e98606bf2a81dc3ff5d7c909e3695 Deployed comparison archive SHA-256: 1bd23217356ee3808e040d39aea5be9519bda7c8f2b4924656a70aff8ad7293a |