Serialize build retirement and clone classification, bound ops accepts

Review fixes for M7.6-M7.9. Schema v9 applies one lock order: the
barrier takes a database-wide upgrade lock exclusively, while
acquisitions, lease checks, provisioning and the retired-build trigger
take it shared first, so a queued acquisition can no longer regain
authority for a just-retired build and concurrent barriers cannot
retire the last current build. Provisioning takes a per-world lock
before classifying a world as original or a clone of one source. The
operations listener makes at most four accept attempts per serve().
Race regressions prove each contender is blocked before commit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
dingo
2026-09-29 08:38:13 -04:00
co-authored by Claude Opus 5.5
parent f59cca2c3b
commit 168c90d5b2
14 changed files with 616 additions and 15 deletions
+17 -2
View File
@@ -35,23 +35,34 @@ SELECT EXISTS (SELECT 1 FROM pg_catalog.pg_namespace WHERE nspname='evolution')
:'history' = '1:' || :'migration_sha' || ',2:' || :'migration_sha_2'
|| ',3:' || :'migration_sha_3' || ',4:' || :'migration_sha_4'
|| ',5:' || :'migration_sha_5' || ',6:' || :'migration_sha_6'
|| ',7:' || :'migration_sha_7' || ',8:' || :'migration_sha_8' AS at_v8 \gset
\if :at_v8
|| ',7:' || :'migration_sha_7' || ',8:' || :'migration_sha_8' AS at_v8,
:'history' = '1:' || :'migration_sha' || ',2:' || :'migration_sha_2'
|| ',3:' || :'migration_sha_3' || ',4:' || :'migration_sha_4'
|| ',5:' || :'migration_sha_5' || ',6:' || :'migration_sha_6'
|| ',7:' || :'migration_sha_7' || ',8:' || :'migration_sha_8'
|| ',9:' || :'migration_sha_9' AS at_v9 \gset
\if :at_v9
\elif :at_v8
\ir 0009_serialized_authority.sql
\elif :at_v7
\ir 0008_upgrade_barrier.sql
\ir 0009_serialized_authority.sql
\elif :at_v6
\ir 0007_region_clones.sql
\ir 0008_upgrade_barrier.sql
\ir 0009_serialized_authority.sql
\elif :at_v5
\ir 0006_commit_lookup.sql
\ir 0007_region_clones.sql
\ir 0008_upgrade_barrier.sql
\ir 0009_serialized_authority.sql
\elif :at_v4
\ir pre_v5_guard.sql
\ir 0005_batch_decisions.sql
\ir 0006_commit_lookup.sql
\ir 0007_region_clones.sql
\ir 0008_upgrade_barrier.sql
\ir 0009_serialized_authority.sql
\elif :at_v3
\ir 0004_lineage_profile.sql
\ir pre_v5_guard.sql
@@ -59,6 +70,7 @@ SELECT EXISTS (SELECT 1 FROM pg_catalog.pg_namespace WHERE nspname='evolution')
\ir 0006_commit_lookup.sql
\ir 0007_region_clones.sql
\ir 0008_upgrade_barrier.sql
\ir 0009_serialized_authority.sql
\elif :at_v2
\ir 0003_region_checkpoints.sql
\ir 0004_lineage_profile.sql
@@ -67,6 +79,7 @@ SELECT EXISTS (SELECT 1 FROM pg_catalog.pg_namespace WHERE nspname='evolution')
\ir 0006_commit_lookup.sql
\ir 0007_region_clones.sql
\ir 0008_upgrade_barrier.sql
\ir 0009_serialized_authority.sql
\elif :at_v1
\ir 0002_region_fencing.sql
\ir 0003_region_checkpoints.sql
@@ -76,6 +89,7 @@ SELECT EXISTS (SELECT 1 FROM pg_catalog.pg_namespace WHERE nspname='evolution')
\ir 0006_commit_lookup.sql
\ir 0007_region_clones.sql
\ir 0008_upgrade_barrier.sql
\ir 0009_serialized_authority.sql
\else
\echo 'Unknown or changed migration history'
DO $$ BEGIN RAISE EXCEPTION 'unknown or changed migration history'; END $$;
@@ -90,6 +104,7 @@ SELECT EXISTS (SELECT 1 FROM pg_catalog.pg_namespace WHERE nspname='evolution')
\ir 0006_commit_lookup.sql
\ir 0007_region_clones.sql
\ir 0008_upgrade_barrier.sql
\ir 0009_serialized_authority.sql
\endif
-- Effective-privilege audit on every run, including no-ops (ADR-0060). Attributes
-- alone are insufficient: predefined roles such as pg_write_all_data, PUBLIC