Fix object reuse durability and refuse unsafe pre-v5 upgrades

Review P1 (object durability): a name installed by a put whose directory
fsync failed was later reused as success without syncing again, so a
publication could acknowledge an object that might vanish on power
loss. Reuse (existing and lost-link-race paths) now fsyncs the verified
file and the directory before succeeding, and namespace opens always
sync their parent. A test-only ObjectStoreFaults hook injects directory
sync failures; tests cover failed sync then retries, namespace creation
syncs, and publication refusing to proceed until durability holds.

Review P1 (pre-v5 history): v5 recovery requires one durable decision
per terminal actor, but v3/v4 published checkpoints carry none, so an
accepted upgrade could make regions unrecoverable. pre_v5_guard.sql now
runs before 0005 in every upgrade path and refuses (EVL10) when any
published pre-v5 checkpoint exists; genesis-only regions pass. 0005 is
unchanged. CI publishes a real v4 checkpoint and proves the upgrade is
refused with nothing changed; a committed death without a decision is
shown to recover as quarantined history.

Validated: PostgreSQL suites Release x3, clang-tidy, ASan/UBSan x2;
reverting each fix is caught by its test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
dingo
2026-09-28 19:20:35 -04:00
co-authored by Claude Opus 5.5
parent dd7e8028b0
commit ab4bf5355f
10 changed files with 259 additions and 32 deletions
+31
View File
@@ -2265,3 +2265,34 @@ Only clean-to-v1 and exact-v1 restart are supported migration paths at this gate
0.75-0.86 ms.
- Not executed: Docker/Gitea CI, remote object store, process kill, a broker
consumer, an injected failure between commit insert and statement end, and TSan.
### M7.5 review fixes - 2026-09-28
- P1 object durability:
- `put()` now re-fsyncs the file and the directory before reusing an existing
object, on both the found-existing and the lost link-race paths.
- Namespace opens always sync the parent directory.
- A test-only `ObjectStoreFaults` hook injects directory-sync failures and
counts successful syncs.
- Tests: a namespace-creation sync failure, then a reopen still failing, then
success with exactly 2 syncs. An install sync failure leaves the object
visible but unacknowledged, three retries while syncs fail all return io with
no extra syncs, then success with +1 sync; every reuse adds a sync.
- Publication with 1, 1 and 2 injected failures returns `upload`/io and sends
no manifest (head stays 0), then publishes once syncs succeed.
- Reverting the reuse sync or the always-sync namespace behavior makes these
tests fail.
- P1 pre-v5 history:
- `pre_v5_guard.sql` (EVL10) runs before 0005 in every upgrade path. 0005 and
its checksum are unchanged.
- CI builds a real v4 database: v1 genesis, a lease, and a sequence-1
publication through the v4 function. The v5 upgrade is refused with the
expected message; history stays 1..4, both commits remain, and no decision
table is created. Replacing the guard with a no-op makes that check fail.
- A committed death published without any decision (the state an accepted
legacy upgrade would produce) recovers as `history`, quarantined and never
served.
- Reran GCC14 Release (3 runs), clang-tidy analysis (1) and ASan/UBSan (2)
PostgreSQL suites, all passing, and the repository format check. The changes
are Linux-only persistence code, SQL and tests; the portable targets and
Windows are unchanged.