~ knotless Search/
↑↓ move↵ open⇧↵ all results
0
0

Blobs kept in an S3-compatible bucket, by the reference's variables

Merged
Merged chadtmiller.com asked to merge into main from chadtmiller.com/monolith:s3-blobstore

Blobs can now be kept in an S3-compatible bucket instead of the data directory, configured by the reference's own PDS_BLOBSTORE_S3_* variables. Disk mode is unchanged. A new --s3 harness run, against an in-process S3 store that verifies every signature, holds both sides to the same answers when the store fails, and the server's bucket to what its accounts hold.

Claude Opus 5.5 · high

What changes

spec/. BLOBS.md gains "Where blobs are kept":

  • the variables and the start errors;
  • a data directory keeping its blobs where its first start put them;
  • requests signed with SigV4, with no SSRF guard;
  • objects keyed blocks/<did>/<cid>, the reference's key for a referenced blob;
  • uploadBlob answered only once the store has the object: 500 when the store errs, 504 UpstreamTimeout when it does not answer;
  • getBlob 500 on any failure to read;
  • deletions within a minute, retried across restarts, and never of a blob held again;
  • what the bucket holds.

DURABILITY.md covers power cuts with a bucket, and backups: the snapshot holds no blob bytes, so keep the bucket versioned, and a copy's server needs its own bucket. OPERATIONS.md adds the blobstore metrics target and a blobstore failure log line. LIMITS.md, STORE.md and PDS.md follow.

harness/.

  • lib/s3.mjs is an S3-compatible store in process. It verifies SigV4 (streaming and checksummed bodies too), and can fail requests with a status, a reset, no answer, a delay, or storing then never answering.
  • --s3 (lib/args.mjs, lib/processes.mjs, lib/env.mjs) puts both sides' blobs in a bucket each.
  • checks/blobstore.mjs fails uploads, reads and the server's deletes for both sides alike and compares the answers. It also deletes an object out of band, re-uploads a blob at once and while its deletion lands, and with crashes kills the server with an upload stored but unanswered. It then audits the server's bucket (within a minute) and its data directory, and checks the metrics.
  • checks/operations.mjs adds five bad blobstore environments that must exit 1.
  • checks/backup.mjs gives a snapshot's server its own bucket.
  • gates.mjs adds --s3 crash and lifecycle runs to compare, and a short one to quick.

crates/pds-server.

  • blobstore.rs holds the settings, SigV4 signing, PUT, GET and DELETE through the outbound path (metrics, CLIENT spans, blobstore failure lines), and the deleter.
  • The account log gains blobPut, logged before a PUT so that a kill mid-upload leaves its object to delete, and blobDeleted.
  • The checkpoint gains an optional objects key, written only when non-empty, so disk-mode checkpoints are byte-identical.
  • The service log gains blobsDoomed and blobsDeleted for deleted accounts.
  • A per-object turn keeps a delete from ever taking an upload's object.
  • A blobstore file in the data directory records bucket mode.

Why

It brings blob storage up to the reference, which offers an S3 blob store by the same variables, and blobs are what fill a single server's disk. The reference was observed against the harness's store to settle the answers. A PUT error gives 500; a reset or timeout gives 504 UpstreamTimeout; a failed GET, a missing object included, gives 500. Given no answer on a GET, the reference waits past its own timeout (an SDK quirk), so that one case holds the server to the spec alone.

How it was checked

  • Against the server before this change, the bucket audit and the bad-environment starts fail.
  • Bugs planted, each seen failing, then put back:
    • strays never deleted: "an object of a blob the account no longer holds";
    • a timeout answered 500: the uploadBlob comparison;
    • deleting an object without its turn or a recheck: getBlob 500 against 200 in the race step.
  • Here, on the final source:
    • --steps 400 --seed 61 --crash-every 25 --s3: all agree;
    • --lifecycle --steps 12 --s3: all agree;
    • --steps 400 --seed 1: all agree.
  • The implementing agent's runs: --seed 24 --crash-every 15 --firehose and --upgrade pass. cargo test -p pds-server (331 tests) and clippy are clean; fmt is clean.
  • just nightly here before queueing.

Shortcomings

  • The reference's getBlob with a store that never answers is not compared (it hangs).
  • A record's first ref to an upload touches no store on the server, where the reference copies the object then, so a store failing at that moment answers 500 on the reference only. This is not compared.
  • The harness's store speaks path-style only, so virtual-hosted addressing and the AWS_* credential fallback are covered only by the server's own tests.
  • No migration between disk and bucket: a data directory keeps the mode it started with.
Approved

This adds an S3-compatible bucket as a place to keep blobs, set by the reference's PDS_BLOBSTORE_S3_* variables, plus an --s3 harness run against an in-process store that verifies SigV4.

I found no problems in what I read. The spec side is complete and written as what is: BLOBS.md has the variables, start errors, keys, failure answers and deletion rules. DURABILITY.md, OPERATIONS.md, LIMITS.md, STORE.md and PDS.md follow it. The README says what is built, not how. No Cargo.toml is in the diff, so no atproto or MCP crates were added. harness/conformance.yaml is untouched, so there are no new excuses to check. The new checks each say what they compare. The one case the reference can't answer, getBlob with a store that never answers, is held to the spec alone, and the pull says so.

I did not read the Rust and harness code in the diff. That covers crates/pds-server/src/* (including blobstore.rs and blobs.rs), harness/lib/s3.mjs, harness/checks/blobstore.mjs, blobs.mjs, crashes.mjs, lifecycle.mjs, operations.mjs, compare.mjs, and lib/processes.mjs. I judged from the spec side and the pull's account of its checks.

The gates run on this head was still running when I looked, so I have no result from it to report. The new --s3 runs in gates.mjs are the proof for the code I skipped.

Merged as bbbecb5