Cut PostgreSQL CI time: parallel builds and split qualification
Foundation / checks (ecs) (push) Successful in 5m55s
Foundation / checks (deploy) (push) Successful in 6m56s
Foundation / checks (tsan) (push) Successful in 9m35s
Foundation / checks (client) (push) Successful in 20m0s
Foundation / checks (network) (push) Successful in 22m38s
Foundation / checks (checks) (push) Successful in 44m57s
Foundation / checks (postgres) (push) Successful in 48m59s
Foundation / server-image (push) Successful in 40s
Foundation / image (push) Successful in 3m11s
Foundation / postgres-tools (push) Successful in 4m26s

Compile the PostgreSQL stages with PG_BUILD_JOBS=6 (was 2), including
PostgreSQL itself. postgres-check.sh gains --full (release),
--sanitizer (ASan: C++ suite plus backup/DR/upgrade process checks that
run the instrumented binaries) and --suite-only (clang-tidy build), so
SQL-only checks run once. Each run prints per-phase timings, and the
postgres job logs runner CPU, memory and disk headroom.

Also refresh the dev REGION_SESSION_WINDOW.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
dingo
2026-10-13 08:38:26 -04:00
co-authored by Claude Opus 5.5
parent 08b4e843c1
commit a33755c60d
6 changed files with 83 additions and 15 deletions
+55 -4
View File
@@ -1,6 +1,37 @@
#!/usr/bin/env bash
set -euo pipefail
# Usage: postgres-check.sh [--full|--sanitizer|--suite-only] <evo-postgres-tests>
# postgres-check.sh --life-reservations-only [<evo-postgres-tests>]
# --full (default) is the complete qualification: the C++ suite, the backup, DR and
# upgrade process checks, then the SQL-only migration, permission and checksum checks.
# --sanitizer keeps everything that runs the binaries built beside the test binary
# (the C++ suite and the backup/DR/upgrade checks, which spawn that evo-server and
# evo-world-clone) and drops the SQL-only checks, which do not change with compiler
# flags. --suite-only runs just the C++ suite (for the uninstrumented analysis build).
root="$(cd "$(dirname "$0")/../.." && pwd)"
mode=full
case "${1:-}" in
--full) shift ;;
--sanitizer) mode=sanitizer; shift ;;
--suite-only) mode=suite-only; shift ;;
--life-reservations-only) mode=life-reservations ;;
esac
# Per-phase wall-clock timing; the summary is printed on success and on failure.
phase_names=() phase_secs=() phase_name=setup phase_start=$SECONDS run_start=$SECONDS
phase() {
phase_names+=("$phase_name") phase_secs+=($((SECONDS - phase_start)))
phase_name=$1 phase_start=$SECONDS
echo "postgres-check[$mode]: phase $phase_name"
}
timing_summary() {
local i
phase_names+=("$phase_name") phase_secs+=($((SECONDS - phase_start)))
echo "postgres-check[$mode] timing ($1):"
for i in "${!phase_names[@]}"; do
printf ' %-28s %5ds\n' "${phase_names[$i]}" "${phase_secs[$i]}"
done
printf ' %-28s %5ds\n' total $((SECONDS - run_start))
}
prefix="$root/.cache/postgres/install"
export PATH="$prefix/bin:$PATH"
export LD_LIBRARY_PATH="$prefix/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
@@ -9,15 +40,17 @@ chmod 700 "$test_dir"
export PGHOST="$test_dir" PGPORT=55432 PGDATABASE=postgres PGUSER="$(id -un)"
unset PGHOSTADDR PGPASSWORD PGSERVICE PGSERVICEFILE
initdb -D "$test_dir/data" --no-locale --encoding=UTF8 --auth-local=trust --auth-host=reject > "$test_dir/init.log"
trap 'pg_ctl -D "$test_dir/data" -m immediate stop > /dev/null || true' EXIT
trap 'rc=$?; timing_summary "exit $rc" >&2; pg_ctl -D "$test_dir/data" -m immediate stop > /dev/null || true' EXIT
pg_ctl -D "$test_dir/data" -l "$test_dir/server.log" -o "-k $test_dir -p 55432 -c listen_addresses=''" -w start
# Runtime group role receives grants; a separate login inherits only that role.
psql -X -v ON_ERROR_STOP=1 -c 'CREATE ROLE evo_runtime_test NOLOGIN' \
-c 'CREATE ROLE evo_runtime_login LOGIN IN ROLE evo_runtime_test'
export EVO_PG_RUNTIME_ROLE=evo_runtime_test EVO_PG_RUNTIME_USER=evo_runtime_login
phase migrate
bash "$root/tools/migrate-postgres.sh"
bash "$root/tools/migrate-postgres.sh" # exact supported upgrade/restart is a no-op
if [ "${1:-}" = --life-reservations-only ]; then
if [ "$mode" = life-reservations ]; then
phase life-reservations
if [ "$#" = 2 ]; then "$2" --life-reservations-only; fi
psql -X -v ON_ERROR_STOP=1 -f "$root/tools/ci/life-reservations-check.sql" > /dev/null
bash "$root/tools/ci/life-reservations-concurrency.sh"
@@ -35,19 +68,35 @@ export EVO_SOURCE_ROOT="$root"
export EVO_SERVER_BIN EVO_WORLD_CLONE_BIN
EVO_SERVER_BIN="$(dirname "${1:?path to evo-postgres-tests}")/evo-server"
EVO_WORLD_CLONE_BIN="$(dirname "$1")/evo-world-clone"
phase cxx-suite
if ! "$1"; then
echo 'PostgreSQL integration tests failed; recent disposable-cluster server log:' >&2
tail -n 80 "$test_dir/server.log" >&2 || true
exit 1
fi
psql -X -v ON_ERROR_STOP=1 -f "$root/tools/ci/life-reservations-check.sql" > /dev/null
bash "$root/tools/ci/life-reservations-concurrency.sh"
if [ "$mode" = suite-only ]; then
echo "postgres-check[suite-only]: $1 passed; process and SQL checks run in --full"
exit 0
fi
if [ "$mode" = full ]; then
phase life-reservations
psql -X -v ON_ERROR_STOP=1 -f "$root/tools/ci/life-reservations-check.sql" > /dev/null
bash "$root/tools/ci/life-reservations-concurrency.sh"
fi
phase backup-check
# M8.7: online backup under load, restore on a separate cluster, isolated rebuild.
bash "$root/tools/ci/backup-check.sh"
phase dr-check
# M8.8: host-loss rehearsal: in-place restore, fenced old environment, measured rewind.
bash "$root/tools/ci/dr-check.sh"
phase upgrade-check
# M8.9: failed migration under load and the version barrier with real hosts.
bash "$root/tools/ci/upgrade-check.sh"
if [ "$mode" = sanitizer ]; then
echo "postgres-check[sanitizer]: suite and process checks passed; SQL-only checks run in --full"
exit 0
fi
phase migration-history
v1_sha="$(sha256sum "$root/migrations/0001_region_bootstrap.sql")"
v1_sha="${v1_sha%% *}"
# Migration failure must not publish a partial schema.
@@ -151,6 +200,7 @@ PGDATABASE=v6_populated bash "$root/tools/migrate-postgres.sh"
test "$(PGDATABASE=v6_populated psql -XAtc "SELECT string_agg(version::text, ',' ORDER BY version) FROM evolution.schema_migrations")" = 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33
test "$(PGDATABASE=v6_populated psql -XAtc "SELECT count(*) FROM evolution.region_commits c, LATERAL evolution.parse_checkpoint_manifest(c.manifest) m WHERE m.commit_sequence = 0 AND m.predecessor_commit IS NULL")" = 1
test "$(PGDATABASE=v6_populated psql -XAtc "SELECT string_agg(conname, ',') FROM pg_constraint WHERE conrelid = 'evolution.region_heads'::regclass AND contype = 'c' AND pg_get_constraintdef(oid) LIKE '%end_tick%'")" = region_heads_published_tick
phase permission-audit
# Inherited privileges bypass fencing, so every migrate run audits effective rights.
psql -X -v ON_ERROR_STOP=1 -c 'CREATE ROLE evo_bad_runtime NOLOGIN IN ROLE pg_write_all_data'
if (export PGDATABASE=migration_rollback EVO_PG_RUNTIME_ROLE=evo_bad_runtime; \
@@ -198,6 +248,7 @@ expect_audit_failure 'GRANT SELECT ON evolution.cellular_mutation_action_publica
expect_audit_failure 'GRANT SELECT ON evolution.account_controls TO evo_runtime_test' 'REVOKE SELECT ON evolution.account_controls FROM evo_runtime_test'
expect_audit_failure 'REVOKE EXECUTE ON FUNCTION evolution.claim_account_control(evolution.u64, evolution.u64, uuid, evolution.u64, uuid, evolution.u64, evolution.u64, integer) FROM evo_runtime_test' 'GRANT EXECUTE ON FUNCTION evolution.claim_account_control(evolution.u64, evolution.u64, uuid, evolution.u64, uuid, evolution.u64, evolution.u64, integer) TO evo_runtime_test'
bash "$root/tools/migrate-postgres.sh" # Restored configuration passes the audit again.
phase checksum-drift
# Unknown future versions and checksum drift must not be repaired silently.
psql -X -v ON_ERROR_STOP=1 -c 'UPDATE evolution.schema_migrations SET version=34 WHERE version=33'
if bash "$root/tools/migrate-postgres.sh"; then exit 1; fi
+1 -1
View File
@@ -15,6 +15,6 @@ if [ ! -d postgresql-18.6 ]; then tar -xjf "$archive"; fi
mkdir -p build
cd build
../postgresql-18.6/configure --prefix="$cache/install" --without-readline --without-icu --with-ssl=openssl
make -j2
make -j"${PG_BUILD_JOBS:-6}"
make install
"$cache/install/bin/pg_config" --version