Skip to content

Add overflow caches - #1845

Merged
Ericson2314 merged 8 commits into
masterfrom
overflow-bucket
Aug 3, 2026
Merged

Add overflow caches#1845
Ericson2314 merged 8 commits into
masterfrom
overflow-bucket

Conversation

@Mic92

@Mic92 Mic92 commented Jul 29, 2026

Copy link
Copy Markdown
Member

The high-level idea is that we can different buckets for staging jobsets and have a different retention policies for those.
So if a derivation is only in staging the output would only be in this bucket and later when the derivation is also in an nixos-unstable jobset, we use bucket side copy to migrate it.

This hopefully reduces the long-term storage consumption since we can throw the staging bucket away as we wish.

I have not tested this outside the NixOS test yet that I added.

Mic92 added 8 commits July 29, 2026 06:51
Upcoming server-side copy support needs to parse CopyObject/UploadPartCopy
results and S3 error bodies, not just <UploadId>.

quick-xml was already a dependency anyway.
hydra.nixos.org wants to divert staging-next-only derivations to a separate
overflow S3 bucket. Objects later needed in the default bucket must be copied
over instead of re-uploaded.

Add copy_object_from(): header-signed CopyObject, or multipart UploadPartCopy
above 5 GiB. Both buckets must share endpoint and static credentials.
hydra.nixos.org wants steps that only staging-next needs uploaded to a
separate S3 bucket. Add [overflowStore] with the store URI and the jobsets
whose exclusive steps go there, plus the NixOS option. Routing follows in
later commits.
Initialize it from overflowStore at startup, rebuild it on config reload,
and add Step::wants_overflow() to decide which steps it applies to. Not
used for uploads yet.
Steps whose jobsets are all in overflowStore.jobsets upload to the
overflow bucket. The queue runner uploads there itself, or hands out
presigned URLs for it, with the builder echoing the bucket name in
follow-up requests. Realisations follow the same routing. Unset or
unknown means the default store.
When a step's outputs exist only in the overflow bucket but a non-overflow
jobset needs them, queue a server-side copy of the closure (NARs, listings,
debug-info links, narinfos, log, realisations) instead of rebuilding. The
step stays gated until the copy completed, like pending uploads. Adds copy
counters to the metrics.
Two Garage buckets. A build from the overflow jobset must upload to the
overflow bucket only. A later build from a regular jobset that references
it must trigger a copy back to the default bucket.
$ hydra-queue-runner --prometheus-address [::]:9198
```

Overflow binary cache (optional)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Read here if you want the full explanation.

@Ericson2314
Ericson2314 added this pull request to the merge queue Aug 3, 2026
Merged via the queue into master with commit cdebd8c Aug 3, 2026
2 checks passed
@Ericson2314
Ericson2314 deleted the overflow-bucket branch August 3, 2026 20:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants