Repository navigation
Conversation
The docs say max-parallel-downloads 0 disables parallel downloads. With the file cache enabled and enable-parallel-downloads unset, resolveParallelDownloadsValue turned parallel downloads on anyway, after validation had already run, and NewJobManager then used no global limit. Skip the implicit enable when max-parallel-downloads is 0. Fixes GoogleCloudPlatform#5267
Contributor
There was a problem hiding this comment.
Code Review
This pull request updates the configuration rationalization logic to ensure that parallel downloads are not automatically enabled when max-parallel-downloads is explicitly set to 0, which signifies that parallel downloads are disabled. It also adds corresponding unit tests to verify this behavior for different configuration values (0, -1, and positive integers). I have no feedback to provide as there are no review comments.
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.
Description
The config-file docs say for
max-parallel-downloads: "0: Disables parallel downloads. Can only be used if--enable-parallel-downloadsis not passed or is passed asfalse."Since parallel downloads became default-on for file cache users,
resolveParallelDownloadsValuesetsEnableParallelDownloads = truewhenever the file cache is enabled andenable-parallel-downloadsis not set by the user, regardless ofmax-parallel-downloads. Validation runs before rationalization, so the existing "must not be 0 when enable-parallel-downloads is true" check never sees this case.The result:
--cache-dir=... --file-cache-max-size-mb=100 --file-cache-max-parallel-downloads=0ends with parallel downloads on.NewJobManageronly applies the limit whenMaxParallelDownloads > 0and otherwise usesmath.MaxInt64, so the global limit on download goroutines is gone.This change skips the implicit enable when
max-parallel-downloadsis 0. An explicitenable-parallel-downloads: truetogether with 0 is still rejected by validation as before, and the default (no flags) and-1(unlimited) still enable parallel downloads.Link to the issue in case of a bug fix.
Fixes #5267
Testing details
--cache-dir=/tmp/x --file-cache-max-size-mb=100 --file-cache-max-parallel-downloads=0: before the change enable-parallel-downloads=true, after it false. Same for the equivalent YAML config (cache-dir+file-cache: {max-size-mb: 100, max-parallel-downloads: 0}). The default,enable-parallel-downloads=falseandenable-parallel-downloads=truecases are unchanged.TestRationalize_ParallelDownloadsConfig(max-parallel-downloads 0 -> disabled, -1 -> enabled) and set an explicit max-parallel-downloads on the existing file-cache-enabled case. The new 0 case fails on master and passes with the change.go test ./cfg/...passes.Any backward incompatible change? If so, please explain.
Only for configs that set
max-parallel-downloads: 0without settingenable-parallel-downloads: they now get parallel downloads disabled (as documented) instead of enabled with no global limit.This change was drafted with Claude Code (claude-opus-5-5); the test results above are from the runs described.