← Back to list
01Issue
FeatureClosedSwamp CLIPublic
AssigneesNone
Relationships
#1733 Skip 50MB monolithic index rewrite on v2 shard-first path
Opened by magistr · 8/19/2026
Summary
On the shard-first (v2) path, the local .datastore-index.json (50MB, 129k entries) is rewritten via atomicWriteTextFile on every slow-path sync — both pull (s3_cache_sync.ts:1682) and push (s3_cache_sync.ts:2018-2021, 2302-2306). This is expensive:
JSON.stringifyof 129k entries- Atomic write (write-to-temp + rename) of 50MB
- Called twice per command (once in pull, once in push)
In v2 mode, shards are the source of truth. The monolithic local index is only used as an in-memory cache and for the legacy ETag-based fast path fallback. With the commitSeq fast path working (once the companion bugs are fixed), the ETag-based fallback won't be needed.
Suggested fix
- When the v2 commitSeq fast path is functional, skip the monolithic index rewrite entirely on the shard path.
- As an interim measure, make the rewrite lazy — only write when
this.indexMutatedis true (zombie entries removed) rather than on every pull/push cycle. - Consider keeping the in-memory index without persisting it when shards are the authority.
References
s3_cache_sync.ts:1680-1684(pullChanged — always rewrites after shard assembly)s3_cache_sync.ts:2015-2023(pushChanged — always rewrites after shard assembly).datastore-index.jsonis 50MB / 129k entries in the observed repo
Upstream repository: https://github.com/systeminit/swamp-extensions
Environment
- Extension:
@swamp/s3-datastore@2026.08.12.1 - swamp:
20260819.011806.0-sha.a9c7ee9a - OS:
darwin(x86_64) - Deno:
2.8.3 - Shell:
/bin/zsh
02Bog Flow
Closed
No activity in this phase yet.
03Sludge Pulse