Skip to content

feat(dist): stage fresh toolchains before atomic publication#4965

Draft
cachebag wants to merge 4 commits into
rust-lang:mainfrom
cachebag:poc/staged-toolchain-install
Draft

feat(dist): stage fresh toolchains before atomic publication#4965
cachebag wants to merge 4 commits into
rust-lang:mainfrom
cachebag:poc/staged-toolchain-install

Conversation

@cachebag

@cachebag cachebag commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

WIP do not merge

This PR employs the second point of the plan discussed in #4663 (details in my design notes), addressing #4400 and #4724 for fresh installs.

The idea is that now a fresh toolchain builds in its own "staging" directory and is then published to toolchains/<name> with a rename being done at the same time as well as the update hash only being written after it is published. In the case of an interrupted install, this now allows for no partial toolchain to be emitted as well as the ability to retry.

Updates still modify toolchains in place, and blocking instead of failing is deferred to the locking work in #988.

I am going to rebase onto #4966 once is merged.

@cachebag
cachebag force-pushed the poc/staged-toolchain-install branch 2 times, most recently from 6189268 to 0611f4c Compare July 20, 2026 01:30
@rami3l rami3l self-assigned this Jul 20, 2026
@rami3l
rami3l self-requested a review July 20, 2026 08:46
@cachebag
cachebag marked this pull request as draft July 20, 2026 10:35
@cachebag
cachebag force-pushed the poc/staged-toolchain-install branch from 0611f4c to 888bd54 Compare July 23, 2026 12:37
cachebag added 2 commits July 23, 2026 09:24
…g dir

Fresh dist installs now stage under `toolchains/+rustup-staging-<name>`,
so interrupted installs of the same toolchain reuse a single staging
directory instead of accumulating abandoned ones. The stage is guarded
by an exclusive advisory file lock held for its lifetime: a dead owner's
stage is reclaimed on the next attempt, while a live owner makes the
contending install fail fast with a clear error. Blocking instead of
failing, and serializing whole operations, is left to the locking work
tracked in rust-lang#988.

Publication failures are classified: if the destination appeared while
the install was staging, the error now says so instead of surfacing a
bare rename failure.

The staged dispatch moves into `InstallMethod::run`, checkpoint names
become exported constants co-located with their checkpoint sites, and
the stray-hash removal in `install_into` is dropped as unreachable:
staged installs never read the alias-scoped hash and rewrite it after
publication.
Interrupted installs are asserted to reuse one deterministic staging
path; a stale stage left by a dead process is reclaimed without leaking
its contents into the published toolchain; and a stray update hash is
ignored during a staged install and refreshed after publication.
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