Skip to main content
← Back to list
01Issue
BugOpenExtensionsPublic
AssigneesNone

Relationships

#2349 s3/gcs datastore: no safe recovery when _meta.json v2 lists a shard missing from the bucket

Opened by hammz · 9/22/2026

Summary

Follow-up to #2327 (@swamp/s3-datastore, @swamp/gcs-datastore). #290 (swamp-club #2245) fixed the cause: pushes no longer delete shards, and index writes use compare-and-swap. But a bucket that is already in the state #2327 describes (_meta.json v2 lists a shard that has no object) still has no safe built-in repair.

Gaps

  1. Misleading hint. assembleIndexFromShards and assembleDirtyShardsOnly in datastore/s3/extensions/datastores/_lib/s3_cache_sync.ts (~L1431, ~L1528) throw Shard ... listed in _meta.json v2 but missing from S3 — index is corrupt. Run 'swamp datastore migrate-index' to rebuild. That command is unsafe here. migrateMonolithToShards regroups the monolithic .datastore-index.json and rewrites every shard, so any entry newer than the monolith is lost.
  2. Recovery is gated off. recoverMetaFromListing, which rebuilds _meta.json from the shards that actually exist, runs only when the monolith has no entries (~L1334). A stale monolith makes it unreachable. The #2327 reporter had to rewrite _meta.json by hand.
  3. Hard failure on a missing shard. Every pull, preparePush, and push fails, which crash-loops swamp serve on startup. It's worth deciding whether a missing listed shard should be treated as empty (with a warning and a meta repair on the next commit) rather than as fatal.

The GCS datastore has the same messages and gating, so check it too.

Suggested direction

  • Give migrate-index (or a new repair command) a mode that rebuilds _meta.json from the _index/ listing, keeps commitSeq, writes with CAS, and never touches shard contents. Point the error message at that mode.
  • Don't suggest the monolith rebuild once a v2 meta with commitSeq > 1 exists.
02Bog Flow
◉OPEN○TRIAGED○IN PROGRESS○SHIPPED

Open

9/22/2026, 5:46:18 PM

No activity in this phase yet.

03Sludge Pulse

Sign in to post a ripple.