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:
@@ -54,8 +54,12 @@ computes commit digests, and the host checks that the receipt matches.
|
||||
are named by the hex SHA-256 of their content.
|
||||
- Upload writes a private temporary file, fsyncs it, `link()`s it to the key (a
|
||||
link never replaces an existing name), and then fsyncs the directory.
|
||||
- Existing identical content is reused. Differing content already under a key is
|
||||
reported as corrupt and never overwritten.
|
||||
- Existing identical content is reused only after its file and directory are
|
||||
fsynced again, whether it came from an earlier attempt whose directory sync failed
|
||||
or from a concurrent installer. A visible name alone is not durability (review
|
||||
fix). Namespace directories sync their parent on every open, not only on
|
||||
creation. Differing content already under a key is reported as corrupt and never
|
||||
overwritten.
|
||||
- Reads use `O_NOFOLLOW`, check an exact-length regular file before allocating,
|
||||
and verify the digest.
|
||||
- There is no delete or GC operation: unreferenced uploads are orphans.
|
||||
|
||||
@@ -63,6 +63,13 @@ parameter; these profiles can produce at most 2. The decision identity is
|
||||
outbox rows only a first delivery timestamp (EVL09).
|
||||
- The runtime role's audited function set grows to ten.
|
||||
|
||||
**Upgrades** from v3 or v4 run `migrations/pre_v5_guard.sql` inside the same
|
||||
transaction, before 0005. The guard refuses (EVL10), changing nothing, if any
|
||||
published pre-v5 checkpoint exists (sequence > 0). Such a checkpoint may hold
|
||||
terminal organisms without decisions, and v5 recovery would quarantine it.
|
||||
Genesis-only regions pass, because tick 0 has no terminal organisms. A verified
|
||||
legacy-history conversion is future work; there is none now.
|
||||
|
||||
**Recovery** loads decisions and requires lifecycle agreement:
|
||||
- one death per terminal actor, none for an active actor;
|
||||
- no death after the head tick, and organisms match the profile;
|
||||
|
||||
Reference in New Issue
Block a user