Add fenced durable primitive life reservations (M11.2c-1)
Foundation / checks (deploy) (push) Successful in 14s
Foundation / checks (ecs) (push) Successful in 2m3s
Foundation / checks (postgres) (push) Canceled after 0s
Foundation / checks (tsan) (push) Canceled after 0s
Foundation / postgres-tools (push) Canceled after 0s
Foundation / server-image (push) Canceled after 0s
Foundation / image (push) Canceled after 0s
Foundation / checks (checks) (push) Canceled after 5m17s
Foundation / checks (client) (push) Canceled after 5m17s
Foundation / checks (network) (push) Canceled after 2m57s
Foundation / checks (deploy) (push) Successful in 14s
Foundation / checks (ecs) (push) Successful in 2m3s
Foundation / checks (postgres) (push) Canceled after 0s
Foundation / checks (tsan) (push) Canceled after 0s
Foundation / postgres-tools (push) Canceled after 0s
Foundation / server-image (push) Canceled after 0s
Foundation / image (push) Canceled after 0s
Foundation / checks (checks) (push) Canceled after 5m17s
Foundation / checks (client) (push) Canceled after 5m17s
Foundation / checks (network) (push) Canceled after 2m57s
This commit is contained in:
@@ -42,6 +42,9 @@ echo change >> tools/ci/dr-check.sh; git commit -qam dr-script
|
||||
script_base="$(git rev-parse HEAD~1)"
|
||||
expect "push: only dr-check.sh changed runs postgres" 0 CI_EVENT=push "CI_BEFORE=$script_base" -- postgres
|
||||
expect "push: only dr-check.sh changed skips image" 1 CI_EVENT=push "CI_BEFORE=$script_base" -- image
|
||||
life_base="$(git rev-parse HEAD)"
|
||||
echo check > tools/ci/life-reservations-check.sql; git add .; git commit -qm life-check
|
||||
expect "push: life reservation check runs postgres" 0 CI_EVENT=push "CI_BEFORE=$life_base" -- postgres
|
||||
# Client dependency updates must select the isolated client gate.
|
||||
mkdir -p tools
|
||||
client_base="$(git rev-parse HEAD)"
|
||||
|
||||
@@ -31,7 +31,7 @@ fi
|
||||
# Every suite runs when the workflow or this selector changes.
|
||||
common='\.gitea/workflows/|tools/ci/ci-paths\.sh'
|
||||
native='CMakeLists\.txt|CMakePresets\.json|cmake/|include/|src/|apps/'
|
||||
postgres_tools='migrations/|tools/prepare-postgres\.sh|tools/migrate-postgres\.sh|tools/backup/|tools/ci/postgres-check\.sh|tools/ci/backup-check\.sh|tools/ci/dr-check\.sh|tools/ci/upgrade-check\.sh'
|
||||
postgres_tools='migrations/|tools/prepare-postgres\.sh|tools/migrate-postgres\.sh|tools/backup/|tools/ci/postgres-check\.sh|tools/ci/life-reservations-|tools/ci/backup-check\.sh|tools/ci/dr-check\.sh|tools/ci/upgrade-check\.sh'
|
||||
case "$suite" in
|
||||
client)
|
||||
pattern="$common|$native|experiments/(client|ui)/|tools/(prepare-imgui|imgui-pin)\.cmake|tools/prepare-sdl3\\.cmake|tools/sdl3-pin\\.cmake|deploy/docker/Dockerfile"
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
-- Runs only in the isolated PostgreSQL test cluster (tools/ci/postgres-check.sh).
|
||||
\set ON_ERROR_STOP on
|
||||
INSERT INTO evolution.life_allocators VALUES (9750, 1);
|
||||
INSERT INTO evolution.region_leases(world_id,region_id,frame_id) VALUES (9750,1,7),(9750,2,7);
|
||||
INSERT INTO evolution.retained_builds(build_identity) VALUES (decode(repeat('d5',32),'hex'))
|
||||
ON CONFLICT DO NOTHING;
|
||||
SET ROLE evo_runtime_login;
|
||||
SELECT * FROM evolution.acquire_region_lease(9750,1,60000,decode(repeat('d5',32),'hex')) \gset
|
||||
SELECT * FROM evolution.claim_account_control(9750,1,:'lease_holder',:lease_epoch,
|
||||
'11111111-1111-1111-1111-111111111111',1,1,60000) \gset
|
||||
SELECT * FROM evolution.reserve_primitive_life(9750,1,:'lease_holder',:lease_epoch,
|
||||
'11111111-1111-1111-1111-111111111111',:control_generation,10,1) \gset
|
||||
SELECT 1 / ((:life_identity = 1 AND :life_region = 1 AND :rejection = 0)::int);
|
||||
-- Successful allocation retry returns identical IDs, without another counter increment.
|
||||
SELECT * FROM evolution.reserve_primitive_life(9750,1,:'lease_holder',:lease_epoch,
|
||||
'11111111-1111-1111-1111-111111111111',:control_generation,10,1) \gset
|
||||
SELECT 1 / ((:life_identity = 1)::int);
|
||||
-- Capture parameters for PL/pgSQL exception assertions without string interpolation.
|
||||
SELECT set_config('test.holder', :'lease_holder', false),
|
||||
set_config('test.epoch', :'lease_epoch', false);
|
||||
DO $$ BEGIN
|
||||
BEGIN
|
||||
PERFORM evolution.reserve_primitive_life(9750,1,current_setting('test.holder')::uuid,
|
||||
current_setting('test.epoch')::numeric,'11111111-1111-1111-1111-111111111111',1,11,1);
|
||||
RAISE EXCEPTION 'accepted a second outstanding life';
|
||||
EXCEPTION WHEN SQLSTATE 'EVL16' THEN NULL; END;
|
||||
BEGIN
|
||||
PERFORM evolution.reserve_primitive_life(9750,1,current_setting('test.holder')::uuid,
|
||||
current_setting('test.epoch')::numeric,'11111111-1111-1111-1111-111111111111',99,10,1);
|
||||
RAISE EXCEPTION 'accepted stale control';
|
||||
EXCEPTION WHEN SQLSTATE 'EVL02' THEN NULL; END;
|
||||
BEGIN
|
||||
PERFORM evolution.reserve_primitive_life(9750,1,current_setting('test.holder')::uuid,
|
||||
current_setting('test.epoch')::numeric,'11111111-1111-1111-1111-111111111111',1,10,2);
|
||||
RAISE EXCEPTION 'accepted unknown rules';
|
||||
EXCEPTION WHEN SQLSTATE '22023' THEN NULL; END;
|
||||
BEGIN
|
||||
PERFORM 1 FROM evolution.life_reservations;
|
||||
RAISE EXCEPTION 'runtime can access reservations directly';
|
||||
EXCEPTION WHEN insufficient_privilege THEN NULL; END;
|
||||
END $$;
|
||||
SELECT 1 / ((evolution.reject_primitive_life(9750,1,:'lease_holder',:lease_epoch,
|
||||
'11111111-1111-1111-1111-111111111111',1,10,1::smallint) = 1)::int);
|
||||
-- First durable refusal is immutable, including across a different proposed reason.
|
||||
SELECT 1 / ((evolution.reject_primitive_life(9750,1,:'lease_holder',:lease_epoch,
|
||||
'11111111-1111-1111-1111-111111111111',1,10,2::smallint) = 1)::int);
|
||||
SELECT * FROM evolution.reserve_primitive_life(9750,1,:'lease_holder',:lease_epoch,
|
||||
'11111111-1111-1111-1111-111111111111',1,11,1) \gset
|
||||
SELECT 1 / ((:life_identity = 2)::int);
|
||||
SELECT * FROM evolution.reserve_primitive_life(9750,1,:'lease_holder',:lease_epoch,
|
||||
'11111111-1111-1111-1111-111111111111',1,10,1) \gset
|
||||
SELECT 1 / ((:life_identity = 1 AND :rejection = 1)::int);
|
||||
RESET ROLE;
|
||||
SELECT 1 / ((SELECT next_identity = 3 FROM evolution.life_allocators WHERE world_id=9750)::int);
|
||||
UPDATE evolution.life_allocators SET next_identity=18446744073709551615 WHERE world_id=9750;
|
||||
SET ROLE evo_runtime_login;
|
||||
SELECT * FROM evolution.claim_account_control(9750,1,:'lease_holder',:lease_epoch,
|
||||
'55555555-5555-5555-5555-555555555555',1,3,60000) \gset
|
||||
DO $$ BEGIN
|
||||
BEGIN
|
||||
PERFORM evolution.reserve_primitive_life(9750,1,current_setting('test.holder')::uuid,
|
||||
current_setting('test.epoch')::numeric,'55555555-5555-5555-5555-555555555555',1,1,1);
|
||||
RAISE EXCEPTION 'wrapped exhausted allocator';
|
||||
EXCEPTION WHEN SQLSTATE 'EVL05' THEN NULL; END;
|
||||
END $$;
|
||||
RESET ROLE;
|
||||
SELECT 1 / ((SELECT count(*) = 2 FROM evolution.life_reservations WHERE world_id=9750)::int);
|
||||
SELECT 1 / ((SELECT next_identity = 18446744073709551615 FROM evolution.life_allocators WHERE world_id=9750)::int);
|
||||
UPDATE evolution.life_allocators SET next_identity=3 WHERE world_id=9750;
|
||||
-- Deliberate transaction rollback: no allocation or reservation can survive alone.
|
||||
BEGIN;
|
||||
SET LOCAL ROLE evo_runtime_login;
|
||||
SELECT * FROM evolution.reserve_primitive_life(9750,1,:'lease_holder',:lease_epoch,
|
||||
'55555555-5555-5555-5555-555555555555',1,1,1);
|
||||
ROLLBACK;
|
||||
SELECT 1 / ((SELECT next_identity = 3 FROM evolution.life_allocators WHERE world_id=9750)::int);
|
||||
SELECT 1 / ((SELECT count(*) = 2 FROM evolution.life_reservations WHERE world_id=9750)::int);
|
||||
-- Expired region cannot reserve or resolve through its stale authority.
|
||||
UPDATE evolution.region_leases SET expires_at=clock_timestamp()-interval '1 second'
|
||||
WHERE world_id=9750 AND region_id=1;
|
||||
SET ROLE evo_runtime_login;
|
||||
DO $$ BEGIN
|
||||
BEGIN
|
||||
PERFORM evolution.reserve_primitive_life(9750,1,current_setting('test.holder')::uuid,
|
||||
current_setting('test.epoch')::numeric,'11111111-1111-1111-1111-111111111111',1,11,1);
|
||||
RAISE EXCEPTION 'accepted expired region authority';
|
||||
EXCEPTION WHEN SQLSTATE 'EVL02' THEN NULL; END;
|
||||
END $$;
|
||||
SELECT * FROM evolution.acquire_region_lease(9750,2,60000,decode(repeat('d5',32),'hex')) \gset
|
||||
SELECT * FROM evolution.claim_account_control(9750,2,:'lease_holder',:lease_epoch,
|
||||
'11111111-1111-1111-1111-111111111111',2,2,60000) \gset
|
||||
-- A takeover may inspect the reservation while waiting; it grants no body/control
|
||||
-- before the session layer's takeover wait. The original owner remains region 1.
|
||||
SELECT * FROM evolution.reserve_primitive_life(9750,2,:'lease_holder',:lease_epoch,
|
||||
'11111111-1111-1111-1111-111111111111',:control_generation,11,1) \gset
|
||||
SELECT 1 / ((:life_identity = 2 AND :life_region = 1)::int);
|
||||
RESET ROLE;
|
||||
-- Restore tests must retain the allocator above every historical reservation.
|
||||
SELECT 1 / ((SELECT count(*) = 2 FROM evolution.life_reservations WHERE world_id=9750)::int);
|
||||
UPDATE evolution.region_leases SET expires_at=clock_timestamp()-interval '1 second'
|
||||
WHERE world_id=9750;
|
||||
@@ -0,0 +1,65 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
# Only called against the disposable postgres-check cluster. Two independently
|
||||
# connected regions contend for one world allocator, then retry after reconnect.
|
||||
work="$(mktemp -d /tmp/evo-life-reservations.XXXXXXXX)"
|
||||
psql -X -v ON_ERROR_STOP=1 > /dev/null <<'SQL'
|
||||
INSERT INTO evolution.life_allocators VALUES (9751,1);
|
||||
INSERT INTO evolution.region_leases(world_id,region_id,frame_id) VALUES (9751,1,7),(9751,2,7);
|
||||
SQL
|
||||
runtime() { psql -XAt -v ON_ERROR_STOP=1 -U "$EVO_PG_RUNTIME_USER" "$@"; }
|
||||
IFS='|' read -r holder_a epoch_a frame_a duration_a < <(runtime -c "SELECT * FROM evolution.acquire_region_lease(9751,1,60000,decode(repeat('d5',32),'hex'))")
|
||||
IFS='|' read -r holder_b epoch_b frame_b duration_b < <(runtime -c "SELECT * FROM evolution.acquire_region_lease(9751,2,60000,decode(repeat('d5',32),'hex'))")
|
||||
account_a=22222222-2222-2222-2222-222222222222
|
||||
account_b=33333333-3333-3333-3333-333333333333
|
||||
runtime -c "SELECT * FROM evolution.claim_account_control(9751,1,'$holder_a',$epoch_a,'$account_a',1,1,60000)" > /dev/null
|
||||
runtime -c "SELECT * FROM evolution.claim_account_control(9751,2,'$holder_b',$epoch_b,'$account_b',1,1,60000)" > /dev/null
|
||||
reserve_a="SELECT life_identity FROM evolution.reserve_primitive_life(9751,1,'$holder_a',$epoch_a,'$account_a',1,1,1)"
|
||||
reserve_b="SELECT life_identity FROM evolution.reserve_primitive_life(9751,2,'$holder_b',$epoch_b,'$account_b',1,1,1)"
|
||||
# Hold allocator row so both actual independent connections queue for it.
|
||||
psql -X -v ON_ERROR_STOP=1 -c "BEGIN; SELECT * FROM evolution.life_allocators WHERE world_id=9751 FOR UPDATE; SELECT pg_sleep(1); COMMIT" > "$work/lock" &
|
||||
locker=$!
|
||||
# No correctness assumption on which client wins; the shared counter must issue
|
||||
# exactly two distinct identities, even if the lock process starts last.
|
||||
runtime -c "$reserve_a" > "$work/a" &
|
||||
first=$!
|
||||
runtime -c "$reserve_b" > "$work/b" &
|
||||
second=$!
|
||||
wait "$first"; wait "$second"; wait "$locker"
|
||||
test "$(cat "$work/a")" != "$(cat "$work/b")"
|
||||
test "$(runtime -c "$reserve_a")" = "$(cat "$work/a")"
|
||||
test "$(runtime -c "$reserve_b")" = "$(cat "$work/b")"
|
||||
test "$(psql -XAtc 'SELECT next_identity FROM evolution.life_allocators WHERE world_id=9751')" = 3
|
||||
# Same account/request on two independent connections retains exactly one ID.
|
||||
runtime -c "$reserve_a" > "$work/retry1" &
|
||||
first=$!
|
||||
runtime -c "$reserve_a" > "$work/retry2" &
|
||||
second=$!
|
||||
wait "$first"; wait "$second"
|
||||
cmp "$work/a" "$work/retry1"; cmp "$work/a" "$work/retry2"
|
||||
test "$(psql -XAtc 'SELECT count(*) FROM evolution.life_reservations WHERE world_id=9751')" = 2
|
||||
account_c=44444444-4444-4444-4444-444444444444
|
||||
runtime -c "SELECT * FROM evolution.claim_account_control(9751,2,'$holder_b',$epoch_b,'$account_c',1,2,1000)" > /dev/null
|
||||
psql -X -v ON_ERROR_STOP=1 > "$work/expiry-lock" <<'SQL' &
|
||||
BEGIN;
|
||||
SELECT * FROM evolution.life_allocators WHERE world_id=9751 FOR UPDATE;
|
||||
\echo life-lock-held
|
||||
SELECT pg_sleep(2);
|
||||
COMMIT;
|
||||
SQL
|
||||
locker=$!
|
||||
locked=false
|
||||
for attempt in $(seq 1 200); do
|
||||
if grep -q life-lock-held "$work/expiry-lock"; then locked=true; break; fi
|
||||
sleep 0.01
|
||||
done
|
||||
test "$locked" = true
|
||||
if runtime -c "SELECT * FROM evolution.reserve_primitive_life(9751,2,'$holder_b',$epoch_b,'$account_c',1,1,1)" > "$work/expired" 2>&1; then
|
||||
echo 'Expired controller allocated an identity after waiting' >&2; exit 1
|
||||
fi
|
||||
wait "$locker"
|
||||
grep -q 'life control fenced' "$work/expired"
|
||||
test "$(psql -XAtc 'SELECT next_identity FROM evolution.life_allocators WHERE world_id=9751')" = 3
|
||||
test "$(psql -XAtc 'SELECT count(*) FROM evolution.life_reservations WHERE world_id=9751')" = 2
|
||||
psql -X -v ON_ERROR_STOP=1 -c "UPDATE evolution.region_leases SET expires_at=clock_timestamp()-interval '1 second' WHERE world_id=9751" > /dev/null
|
||||
printf '%s\n' 'PASS independent life reservation connections, shared allocator and reconnect retries'
|
||||
@@ -17,6 +17,11 @@ psql -X -v ON_ERROR_STOP=1 -c 'CREATE ROLE evo_runtime_test NOLOGIN' \
|
||||
export EVO_PG_RUNTIME_ROLE=evo_runtime_test EVO_PG_RUNTIME_USER=evo_runtime_login
|
||||
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
|
||||
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"
|
||||
exit 0
|
||||
fi
|
||||
# M7.9 clone target: a separate database with its own runtime group and login,
|
||||
# so a clone shares neither the source's database nor its runtime credentials.
|
||||
psql -X -v ON_ERROR_STOP=1 -c 'CREATE ROLE evo_clone_runtime NOLOGIN' -c 'CREATE ROLE evo_clone_login LOGIN IN ROLE evo_clone_runtime'
|
||||
@@ -30,6 +35,8 @@ 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"
|
||||
"$1"
|
||||
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"
|
||||
# M8.7: online backup under load, restore on a separate cluster, isolated rebuild.
|
||||
bash "$root/tools/ci/backup-check.sh"
|
||||
# M8.8: host-loss rehearsal: in-place restore, fenced old environment, measured rewind.
|
||||
@@ -61,7 +68,7 @@ PGDATABASE=upgrade_path psql -X -v ON_ERROR_STOP=1 -1 -v "migration_sha=$v1_sha"
|
||||
-f "$root/migrations/0001_region_bootstrap.sql" > /dev/null
|
||||
test "$(PGDATABASE=upgrade_path psql -XAtc "SELECT string_agg(version::text, ',') FROM evolution.schema_migrations")" = 1
|
||||
PGDATABASE=upgrade_path bash "$root/tools/migrate-postgres.sh"
|
||||
test "$(PGDATABASE=upgrade_path 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
|
||||
test "$(PGDATABASE=upgrade_path 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
|
||||
# v2 heads have no payload binding: v2->v3 fails closed and leaves history at v2.
|
||||
v2_sha="$(sha256sum "$root/migrations/0002_region_fencing.sql")"
|
||||
v2_sha="${v2_sha%% *}"
|
||||
@@ -82,7 +89,7 @@ PGDATABASE=v3_commits psql -X -v ON_ERROR_STOP=1 \
|
||||
-c "INSERT INTO evolution.retained_builds VALUES (decode(repeat('b1', 32), 'hex'))" \
|
||||
-c "SELECT evolution.provision_region_checkpoint(decode('4145564f52434d31' || '01000000' || '01000000' || '0100000000000000' || '0100000000000000' || '0900000000000000' || repeat('11', 16) || repeat('00', 8) || repeat('00', 16) || repeat('00', 32) || repeat('00', 16) || repeat('00', 16) || repeat('00', 8) || '50c3000000000000' || '020000000200000001000000010000000100000001000000010000000100000001000000' || repeat('b1', 32) || '00000000' || '00000000' || '01000000' || '6400000000000000' || repeat('a0', 32), 'hex'))" > /dev/null
|
||||
PGDATABASE=v3_commits bash "$root/tools/migrate-postgres.sh"
|
||||
test "$(PGDATABASE=v3_commits psql -XAtc "SELECT count(*) || ':' || string_agg(version::text, ',' ORDER BY version) FROM evolution.schema_migrations")" = 14:1,2,3,4,5,6,7,8,9,10,11,12,13,14
|
||||
test "$(PGDATABASE=v3_commits psql -XAtc "SELECT count(*) || ':' || string_agg(version::text, ',' ORDER BY version) FROM evolution.schema_migrations")" = 15:1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
|
||||
test "$(PGDATABASE=v3_commits psql -XAtc "SELECT count(*) FROM evolution.region_commits")" = 1
|
||||
# Review P1: a v4 database holding a published (possibly terminal) checkpoint has
|
||||
# no durable decisions for it. The v5 upgrade must refuse before changing anything.
|
||||
@@ -136,7 +143,7 @@ PGDATABASE=v6_populated psql -X -v ON_ERROR_STOP=1 \
|
||||
-c "INSERT INTO evolution.retained_builds VALUES (decode(repeat('b1', 32), 'hex'))" \
|
||||
-c "SELECT evolution.provision_region_checkpoint(decode('4145564f52434d31' || '02000000' || '01000000' || '0100000000000000' || '0100000000000000' || '0900000000000000' || repeat('11', 16) || repeat('00', 8) || repeat('00', 16) || repeat('00', 32) || repeat('00', 16) || repeat('00', 16) || repeat('00', 8) || '50c3000000000000' || '020000000200000001000000010000000100000001000000010000000100000001000000' || repeat('b1', 32) || '00000000' || '00000000' || '01000000' || '6400000000000000' || repeat('a0', 32) || repeat('00', 80), 'hex'))" > /dev/null
|
||||
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
|
||||
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
|
||||
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
|
||||
# Inherited privileges bypass fencing, so every migrate run audits effective rights.
|
||||
@@ -181,9 +188,9 @@ expect_audit_failure 'GRANT SELECT ON evolution.account_controls TO evo_runtime_
|
||||
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.
|
||||
# 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=15 WHERE version=14'
|
||||
psql -X -v ON_ERROR_STOP=1 -c 'UPDATE evolution.schema_migrations SET version=16 WHERE version=15'
|
||||
if bash "$root/tools/migrate-postgres.sh"; then exit 1; fi
|
||||
psql -X -v ON_ERROR_STOP=1 -c "UPDATE evolution.schema_migrations SET version=14 WHERE version=15"
|
||||
psql -X -v ON_ERROR_STOP=1 -c "UPDATE evolution.schema_migrations SET version=15 WHERE version=16"
|
||||
psql -X -v ON_ERROR_STOP=1 -c "UPDATE evolution.schema_migrations SET sha256=repeat('0',64) WHERE version=14"
|
||||
if bash "$root/tools/migrate-postgres.sh"; then exit 1; fi
|
||||
psql -X -v ON_ERROR_STOP=1 -c "UPDATE evolution.schema_migrations SET sha256=repeat('0',64) WHERE version=13"
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
# exported). Real evo-server processes on world 500:
|
||||
# 1. Failed migration: a migration that takes the migration lock, alters a history
|
||||
# table, holds its locks for 3 s and then fails runs while build b1 serves.
|
||||
# Nothing it did remains (schema still v14, no new column); the host keeps its
|
||||
# Nothing it did remains (schema still v15, no new column); the host keeps its
|
||||
# authority, and every acknowledgement stays durable.
|
||||
# 2. Barrier (ADR-0068 operator order): build b2 is retained, and a b2 host is started
|
||||
# while b1 still holds the lease (it waits, never ready). upgrade_barrier(b1) fences
|
||||
@@ -61,7 +61,7 @@ SQL
|
||||
[ "$code" != 0 ] && grep -q 'division by zero' "$work/migration.log" || fail "the rehearsal migration did not fail"
|
||||
[ "$(q -c "SELECT count(*) FROM information_schema.columns WHERE table_name = 'region_commits' AND column_name = 'rehearsal_column'")" = 0 ] ||
|
||||
fail "the failed migration left a column"
|
||||
[ "$(q -c 'SELECT max(version) FROM evolution.schema_migrations')" = 14 ] || fail "schema version moved"
|
||||
[ "$(q -c 'SELECT max(version) FROM evolution.schema_migrations')" = 15 ] || fail "schema version moved"
|
||||
wait_ack "$work/b1.log" $((before + 40)) || fail "b1 did not resume after the failed migration"
|
||||
kill -0 "$b1_pid" 2> /dev/null || fail "b1 exited during the failed migration"
|
||||
bash "$root/tools/migrate-postgres.sh" > /dev/null || fail "migrate after the failure"
|
||||
|
||||
@@ -40,6 +40,8 @@ digest_13="$(sha256sum "$root/migrations/0013_probe_incoming.sql")"
|
||||
digest_13="${digest_13%% *}"
|
||||
digest_14="$(sha256sum "$root/migrations/0014_probe_overdue.sql")"
|
||||
digest_14="${digest_14%% *}"
|
||||
digest_15="$(sha256sum "$root/migrations/0015_life_reservations.sql")"
|
||||
digest_15="${digest_15%% *}"
|
||||
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" \
|
||||
@@ -47,5 +49,6 @@ psql -X --no-password --set=ON_ERROR_STOP=1 --set="migration_sha=$digest" \
|
||||
--set="migration_sha_8=$digest_8" --set="migration_sha_9=$digest_9" \
|
||||
--set="migration_sha_10=$digest_10" --set="migration_sha_11=$digest_11" --set="migration_sha_12=$digest_12" --set="migration_sha_13=$digest_13" \
|
||||
--set="migration_sha_14=$digest_14" \
|
||||
--set="migration_sha_15=$digest_15" \
|
||||
--set="runtime_role=$runtime_role" \
|
||||
--file="$root/migrations/apply.sql"
|
||||
|
||||
Reference in New Issue
Block a user