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:
@@ -94,3 +94,28 @@ The results are in engineering/DURABILITY_QUALIFICATION.md.
|
||||
mid-upgrade before the new build was deployed.
|
||||
- **In-place rules migration of a live region.** It would change physical laws
|
||||
without the clone-and-compare approval that the vision requires.
|
||||
|
||||
## Amendment: serialized retirement (schema v9, 2026-09-29 review)
|
||||
In v8, acquisition checked eligibility before locking the lease row, without
|
||||
serializing against the barrier. A request queued behind a barrier could
|
||||
therefore acquire for the build just retired, then keep renewing (reproduced by
|
||||
review). Schema v9 fixes this with one lock order: the upgrade lock (advisory,
|
||||
database-wide), then the world classification lock, then the lease row, then
|
||||
head and commit rows.
|
||||
- `upgrade_barrier` takes the upgrade lock exclusively before anything else. This
|
||||
also serializes barriers, so two operators cannot each retire what they believe
|
||||
is a non-last build.
|
||||
- Both acquisition forms, `check_region_lease` (and with it publication, renewal
|
||||
and release), provisioning and the retired-build trigger take the upgrade lock
|
||||
shared first. Their eligibility checks therefore run after any concurrent
|
||||
barrier commits.
|
||||
|
||||
The lock order is the same everywhere, so publication cannot deadlock against the
|
||||
barrier. Regression tests hold a barrier open, prove the contender is blocked,
|
||||
commit, and check that a queued acquisition of the retired build is refused (both
|
||||
forms) and that the last current build cannot be retired by racing barriers.
|
||||
|
||||
A runtime login can still take PostgreSQL advisory locks directly, and so could
|
||||
delay barriers or acquisitions. It cannot gain authority that way. An owner can
|
||||
terminate such sessions. Removing that capability needs a pooler or role policy
|
||||
(M8).
|
||||
|
||||
Reference in New Issue
Block a user