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
+46
View File
@@ -2534,3 +2534,49 @@ Only clean-to-v1 and exact-v1 restart are supported migration paths at this gate
The migration test caught this one after the host-test correction.
- Not executed: Docker, the Gitea CI, cluster runs, a separate database host, and
host or storage loss (M8).
## M7.6–M7.9 review fixes (schema v9) - 2026-09-29
Review `.cache/reviews/M7_6-M7_9_REVIEW.md` found three issues. All three are
fixed:
- **[P1] Build retirement could race acquisition.** Schema v9 applies one
upgrade-lock order across the barrier, acquisitions, lease checks, provisioning
and the retired-build trigger.
- **[P2] Clone-world classification could race.** Provisioning now takes a
per-world lock and checks classification after it.
- **[P2] The operations listener accepted without bound.** Each `serve()` now
makes at most 4 accept attempts.
Evidence:
- WSL Linux `checks` set (Debug, Release, analysis, ASan/UBSan): CTest 59/59
each. The format check passed.
- PostgreSQL ASan/UBSan: full suite passed. Analysis and Release were rerun green
after fixing two clang-tidy findings in the new tests. Upgrade paths now end at
1..9.
- Race tests (database `evo_race`): each holds a transaction open, confirms the
contender is blocked on a lock via `pg_stat_activity`, then commits.
- A build-less acquisition queued behind a barrier is refused (EVL06).
- A build-aware acquisition of the build being retired is refused, and the
region stays unheld.
- The next build acquires.
- Racing barriers for the last two current builds: one returns 22023 and one
build stays current.
- Different-source clones into one world, and an original region racing a
clone: the second is refused (22023).
- Same-source clones into different regions both succeed.
- The final origins are exactly `2/1<10, 4/1<10, 4/2<10`.
- Accept budget:
- With 16 queued connections, successive `serve()` calls give 4 open, then 8
open with 0 refused, then 8 open with 4 refused.
- Refusals never exceed 4 per call under replenished connections.
- The first accepted probe got 200.
- A real server acknowledged 60 ticks under continuous connect/close churn
without losing readiness.
- Mutations, each reverting one fix (restored and rebuilt). Each was caught:
- an unlocked build-aware acquire;
- an unlocked legacy acquire;
- an unlocked barrier;
- no per-world lock;
- an accept budget of 1000.
- Qualification was unchanged: SIGKILL to ready took 19.55–19.60 s.
- Windows was not rerun. All changes are Linux PostgreSQL, server or doc files.