Add overflow caches - #1845
Merged
Merged
Conversation
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.
Mic92
commented
Jul 29, 2026
| $ hydra-queue-runner --prometheus-address [::]:9198 | ||
| ``` | ||
|
|
||
| Overflow binary cache (optional) |
Member
Author
There was a problem hiding this comment.
Read here if you want the full explanation.
Ericson2314
approved these changes
Aug 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.