ADR-0065: before any readiness, recovery now verifies the head's tail. The trace object must exist with its manifest digest, its header must bind profile, region, predecessor and range; the predecessor (schema v6 load_region_commit) must hash to the digest the head names; replaying the trace from the predecessor's verified payload must reproduce every report and the exact head bytes; and trace-derived decisions must equal the head's durable decisions. Missing, corrupt or non-reproducing tails quarantine (RecoveryError::tail); nothing older or empty is served. Test-only crash seams (HostConfig::crash_hook, PublishHooks) and evo-server --crash-at deliver real SIGKILL at before-upload, before-transaction, after-commit and after-ack. The kill matrix, a SIGSTOP/SIGCONT stale owner and damaged-head startups all behave as the durability contract requires; successors verify before readiness. Validated: PostgreSQL suites under GCC Release, clang-tidy and ASan/UBSan; tail-skip and replay-equality mutations each caught. No Docker/Gitea CI, production-lease kill test or deployment. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
33 lines
1.5 KiB
Bash
33 lines
1.5 KiB
Bash
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
root="$(cd "$(dirname "$0")/.." && pwd)"
|
|
# Operator-created NOLOGIN group role granted to the region runtime login (ADR-0060).
|
|
runtime_role="${EVO_PG_RUNTIME_ROLE:?set EVO_PG_RUNTIME_ROLE to the runtime group role}"
|
|
if [ -n "${EVO_PGPASS_SOURCE:-}" ]; then
|
|
umask 077
|
|
export PGPASSFILE
|
|
PGPASSFILE="$(mktemp /tmp/evo-pgpass.XXXXXXXX)"
|
|
trap 'rm -f -- "$PGPASSFILE"' EXIT
|
|
cat "$EVO_PGPASS_SOURCE" > "$PGPASSFILE"
|
|
fi
|
|
# Connection comes from PG* environment / mounted service and password files.
|
|
# Never print the connection or enable shell tracing here.
|
|
digest="$(sha256sum "$root/migrations/0001_region_bootstrap.sql")"
|
|
digest="${digest%% *}"
|
|
digest_2="$(sha256sum "$root/migrations/0002_region_fencing.sql")"
|
|
digest_2="${digest_2%% *}"
|
|
digest_3="$(sha256sum "$root/migrations/0003_region_checkpoints.sql")"
|
|
digest_3="${digest_3%% *}"
|
|
digest_4="$(sha256sum "$root/migrations/0004_lineage_profile.sql")"
|
|
digest_4="${digest_4%% *}"
|
|
digest_5="$(sha256sum "$root/migrations/0005_batch_decisions.sql")"
|
|
digest_5="${digest_5%% *}"
|
|
digest_6="$(sha256sum "$root/migrations/0006_commit_lookup.sql")"
|
|
digest_6="${digest_6%% *}"
|
|
psql -X --no-password --set=ON_ERROR_STOP=1 --set="migration_sha=$digest" \
|
|
--set="migration_sha_2=$digest_2" --set="migration_sha_3=$digest_3" \
|
|
--set="migration_sha_4=$digest_4" --set="migration_sha_5=$digest_5" \
|
|
--set="migration_sha_6=$digest_6" \
|
|
--set="runtime_role=$runtime_role" \
|
|
--file="$root/migrations/apply.sql"
|