Skip to content

Expose a max upload size for stores (#2077) - #3097

Merged
palfrey merged 2 commits into
TraceMachina:mainfrom
rajputdivyanshu81:feat/store-max-upload-size
Nov 2, 2026
Merged

palfrey merged 2 commits into
TraceMachina:mainfrom
rajputdivyanshu81:feat/store-max-upload-size

Conversation

@rajputdivyanshu81

Copy link
Copy Markdown
Contributor

What and why

FastSlowStore passes UploadSizeInfo::MaxSize(u64::MAX) to the fast store when it fills it from an S3, GCS or Azure slow store, because those stores skip the has() that would give the exact size. A fast store that sizes its upload from that bound mishandles it: an S3 fast store refuses u64::MAX with FailedPrecondition (it exceeds MAX_UPLOAD_SIZE), so the fill always fails.

This adds StoreDriver::max_upload_size(), defaulting to u64::MAX (no known limit). S3 (so also R2 and OCI) and Azure return the limits their stores already hard-code; GCS gets its documented 5 TiB limit. FastSlowStore now announces the slow store's limit, since nothing larger could have been stored there.

The digest's size is deliberately not used as an exact size: an AC value's length differs from its key's (see lazy_slow_read_fills_a_compression_fast_tier_with_an_ac_entry).

Fixes #2077

How was this verified?

Two new tests:

  • fast_slow_store_test::lazy_slow_read_announces_the_slow_store_limit_to_the_fast_store: a lazy slow store advertising a limit, and a fast store that records the size it is announced. Fails with the old u64::MAX, passes with the change.
  • s3_store_test::update_accepts_its_advertised_max_upload_size: an S3 store refuses MaxSize(u64::MAX) with FailedPrecondition, and accepts MaxSize(store.max_upload_size()), completing a multipart upload.

Ran cargo test -p nativelink-store --test fast_slow_store_test --test s3_store_test on Windows: 39 and 20 tests pass. I did not run Bazel or clippy locally.

Risk

Low. Only the LazyExistenceOnSync fill path changes, and only the bound it announces.

  • The GCS 5 TiB constant is new; the S3 and Azure values reuse existing constants.
  • Wrapper stores (verify, compression, ...) don't forward the limit and report u64::MAX. This doesn't affect the fill path, which only applies when the slow store resolves to S3/GCS/Azure itself.
  • With an S3 fast store the fill now succeeds instead of failing, but with a 48 TiB bound S3 picks its largest part size (~5 GiB) for large blobs.

AI assistance

Claude Code helped investigate the issue, draft the change and tests, and run them. I reviewed the diff and can answer for every line.

🤖 Generated with Claude Code

Add StoreDriver::max_upload_size(), defaulting to u64::MAX. S3 (and R2/OCI), Azure and GCS report their provider limits. FastSlowStore announces the slow store's limit instead of u64::MAX when it populates the fast store without a has() check, so an S3 fast tier no longer rejects the fill with FailedPrecondition.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
nativelink Ready Ready Preview Nov 2, 2026 1:18pm UTC
nativelink-aidm Ready Ready Preview Nov 2, 2026 1:18pm UTC

Request Review

@CLAassistant

CLAassistant commented Oct 31, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@rajputdivyanshu81

Copy link
Copy Markdown
Contributor Author

@MarcusSorealheis this implements #2077 as discussed. CLA is signed; could you approve the workflows when you have a moment?

@palfrey palfrey left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice catch, thanks

This branch was successfully deployed

2 active deployments
Preview – nativelink — 3d995809 Deployed Nov 2, 2026 by vercel[bot]
Preview – nativelink-aidm — 3d995809 Deployed Nov 2, 2026 by vercel[bot]
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.

Expose a max upload size for stores

3 participants