Skip to content

feat: erofs snapshots of pushed trees, stored next to the repo - #15

Merged
Xe merged 14 commits into
mainfrom
Xe/erofs-commit-snapshots-plan
Sep 23, 2026
Merged

Xe merged 14 commits into
mainfrom
Xe/erofs-commit-snapshots-plan

Conversation

@Xe

@Xe Xe commented Sep 23, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • After each push, objgitd builds a Zstd-compressed erofs image of the tree at every updated branch and tag tip and stores it at snapshots/erofs/v1/<tree>.erofs under the repository prefix, on by default (-erofs-snapshots=false disables it).
  • snapshot.Open downloads an image into a local LRU cache next to the pack cache (a second PackCache, with a byte budget and an idle sweep), for later readers such as a web UI.

Details

Images are keyed by tree hash and built reproducibly, so a branch and a tag on one commit share one image. Builds stream blobs through erofs v0.8.0's AddFileFunc, so memory stays flat (256 MiB of content builds in a 3.3 MiB live heap), and a failed snapshot never fails the push. Adds internal/snapshot, Store on *tigris.Storer, GetChecked/EvictIdle/an observer on PackCache, five objgit_snapshot_* metrics, and the design spec, plan, and upstream erofs streaming spec.

Test plan

  • Code compiles with go build ./...
  • Code formatted with npm run format
  • Manual testing

Xe added 14 commits September 23, 2026 15:41
Adds the design spec, the implementation plan, and the upstream
streaming-builder spec for github.com/Xe/erofs.

Signed-off-by: Xe Iaso <xe@tigrisdata.com>
Signed-off-by: Xe Iaso <xe@tigrisdata.com>
Signed-off-by: Xe Iaso <xe@tigrisdata.com>
Signed-off-by: Xe Iaso <xe@tigrisdata.com>
Adds GetChecked for ids that are not digests, EvictIdle, and an event observer.

Signed-off-by: Xe Iaso <xe@tigrisdata.com>
A hit is now a GetChecked call that returns a file without running a
download. Budget evictions are reported after fill closes ready, so the
observer never holds up a waiter. The fill failure logs use the same
"id" key as the rest of the cache.

Signed-off-by: Xe Iaso <xe@tigrisdata.com>
Storer implements snapshot.Store. OpenSnapshot downloads the whole image
into the snapshot cache and refuses a body that does not match its
erofs-sha256 metadata.

Signed-off-by: Xe Iaso <xe@tigrisdata.com>
After a push, runSnapshots builds one image for the tree at each updated
branch and tag tip, before hooks run. snapshotRefs now returns tags too, and
runHooks keeps running for branches only.

Signed-off-by: Xe Iaso <xe@tigrisdata.com>
Adds -erofs-snapshots, -snapshot-timeout, -snapshot-cache-bytes, and
-snapshot-cache-max-idle. The snapshot cache lives next to the pack cache,
and an errgroup goroutine sweeps idle images out of it.

Signed-off-by: Xe Iaso <xe@tigrisdata.com>
Signed-off-by: Xe Iaso <xe@tigrisdata.com>
-erofs-snapshots now defaults to true. membench gains
-daemon-erofs-snapshots, off by default, so snapshot cost is not counted
as push cost.

Signed-off-by: Xe Iaso <xe@tigrisdata.com>
Moves to github.com/Xe/erofs v0.8.0. Ensure now reads only blob sizes
during the walk and hands the builder an open function through
AddFileFunc, so a build's memory no longer grows with the tree. The two
v0.6.1 workarounds (pre-sizing the temp file, adding the root by hand) are
gone; v0.8.0 fixes both bugs, and the image bytes are unchanged.

A symlink blob's size is now checked before it is read.

Signed-off-by: Xe Iaso <xe@tigrisdata.com>
Signed-off-by: Xe Iaso <xe@tigrisdata.com>
…hots-plan

Resolves conflicts with the webhook and ssh sh work: snapshots now hang off
main's per-request onUpdated updates (filtered to branches and tags), and the
startup orphan sweep is keyed on each cache's own directory prefix so the
snapshot cache never deletes the live pack cache.

Signed-off-by: Xe Iaso <xe@tigrisdata.com>
@Xe
Xe merged commit 2a31f82 into main Sep 23, 2026
10 checks passed
Xe pushed a commit that referenced this pull request Sep 23, 2026
# [1.9.0](v1.8.0...v1.9.0) (2026-09-23)

### Features

* erofs snapshots of pushed trees, stored next to the repo ([#15](#15)) ([2a31f82](2a31f82))

Signed-off-by: Tigris Data <social@tigrisdata.com>
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 1.9.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant