Complete M7.3 fenced region ownership
ADR-0060 and schema v2 add database-time region leases and a fenced head advance. Acquire/renew/release/advance lock the lease row, check holder, epoch and expiry with clock_timestamp() after the lock wait, and the advance compares the exact predecessor. Holders are DB-generated tokens; epochs never wrap or repeat. The runtime group role gets EXECUTE on five SECURITY DEFINER functions only - no table, provisioning or CREATE rights. Migration history admits clean->v2, v1->v2 and a v2 no-op, and refuses privileged runtime roles. Host side: portable LeaseAuthority fences from send-time deadlines on CLOCK_BOOTTIME, keeps the earlier deadline on unknown renewal and stays fenced until a newer epoch. Selected timings: 20s lease, 5s renew, 2s margin, 2s renew and 5s commit deadlines. Linux evo::postgres wraps the functions with typed LeaseStoreError results. Validated: Windows CTest 55/55; WSL Release, clang-tidy and ASan/UBSan private-PostgreSQL suites (contenders, expiry, paused/queued stale writers, unknown renewal, exhaustion, bypass denial, upgrade path). Three SQL mutations were each caught. Docker/Gitea CI, remote TLS and cluster runs were not executed. No director, host or deployment added. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -2041,3 +2041,43 @@ claim lineage recovery. No retained-history or World0 requirement was relaxed.
|
||||
The adapter is separate from the headless kernel. Region fencing, publication,
|
||||
ambiguous durable commit reconciliation and crash recovery are later M7 gates.
|
||||
Only clean-to-v1 and exact-v1 restart are supported migration paths at this gate.
|
||||
|
||||
## M7.3 fenced region ownership - 2026-09-28
|
||||
|
||||
- Windows MSVC Release configure/build/CTest passed 55/55, including the new
|
||||
portable `region-lease-contracts` test. Repository clang-format 19 check passed.
|
||||
- WSL Ubuntu (GCC 14.2.0; clang 19.1.1; PostgreSQL/libpq 18.6 source build):
|
||||
GCC14 Release, clang19 analysis (clang-tidy warnings-as-errors) and clang19
|
||||
ASan/UBSan builds of `evo-postgres-tests` each passed `tools/ci/postgres-check.sh`
|
||||
against a fresh private cluster. The first analysis build flagged two
|
||||
unchecked optional accesses and two unreserved vectors. These were fixed and
|
||||
all three configurations were rerun after formatting.
|
||||
- Real-database coverage, as the runtime login rather than SET ROLE:
|
||||
- Denied (42501): table read/write, provisioning, the internal check function,
|
||||
and object creation. A hostile search_path is ignored.
|
||||
- Busy, forged-holder, stale-epoch and released-lease rejections; epoch
|
||||
non-reuse.
|
||||
- 1..64 tick delta; predecessor mismatch; exact-retry detection via the head.
|
||||
- 1 s database-time expiry and successor acquisition; paused stale writer fenced
|
||||
locally and by the database.
|
||||
- A writer queued 1.3 s on the lease row lock is rejected after expiry.
|
||||
- A 100 ms renewal deadline under lock (unknown) fences locally before a
|
||||
successor acquires.
|
||||
- 64 two-thread acquisition rounds with exactly one winner and consecutive
|
||||
epochs; 32 racing head advances with exactly one winner.
|
||||
- Epoch and sequence exhaustion.
|
||||
- Migrations tested: clean->v2, repeated v2 no-op, v1->v2 upgrade, and failed
|
||||
0001 rollback. Superuser and missing runtime roles are refused with no schema
|
||||
left. Unknown v3, changed v2 checksum and changed v1 checksum are refused.
|
||||
- Mutation sensitivity (scratch copies only): replacing post-lock
|
||||
`clock_timestamp()` with `now()`, removing the lease check from head advance,
|
||||
and disabling the busy check each made the suite fail at the expected test.
|
||||
- Local Unix-socket latency, 200 samples per operation in each final run:
|
||||
- p50 about 0.61-0.74 ms and p99 about 0.8-1.15 ms for acquire, renew,
|
||||
advance and release.
|
||||
- Max up to 2.8 ms under analysis/ASan builds.
|
||||
These are local numbers, not remote TLS or cluster measurements.
|
||||
- Not executed: Docker/Gitea CI, remote TLS endpoints, Kubernetes Secrets, real pod
|
||||
kill, real network partition (a lock wait plus client deadline stands in for
|
||||
it), VM freeze and TSan. The contention threads each own a separate
|
||||
connection; libpq is uninstrumented.
|
||||
|
||||
Reference in New Issue
Block a user