feat(cli): wire --max-alloc=N memory cap to buffer pool#3749
Merged
Conversation
Adds enforcement for the previously parsed-but-ignored --max-alloc flag. A new parse_max_alloc_argument validates the size suffix, rejects zero, and clamps at u64::MAX/4 for arithmetic safety. The resolved cap is propagated through ClientConfig into a new memory_cap field on GlobalBufferPoolConfig, which init_global_buffer_pool feeds into BufferPool::with_memory_cap so backpressure kicks in once outstanding buffer memory hits the limit. The flag is forwarded to remote sender and daemon-server invocations to match upstream rsync's options.c:2845-2846 server_options() emission, and the server-side parser applies the cap locally just like the client.
oferchen
added a commit
that referenced
this pull request
May 18, 2026
* feat(cli): wire --max-alloc=N memory cap to buffer pool Adds enforcement for the previously parsed-but-ignored --max-alloc flag. A new parse_max_alloc_argument validates the size suffix, rejects zero, and clamps at u64::MAX/4 for arithmetic safety. The resolved cap is propagated through ClientConfig into a new memory_cap field on GlobalBufferPoolConfig, which init_global_buffer_pool feeds into BufferPool::with_memory_cap so backpressure kicks in once outstanding buffer memory hits the limit. The flag is forwarded to remote sender and daemon-server invocations to match upstream rsync's options.c:2845-2846 server_options() emission, and the server-side parser applies the cap locally just like the client. * fix(cli): inline format args and replace useless vec! with array
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.
Summary
parse_max_alloc_argumentthat validates K/M/G/T/P/E suffixes, rejects zero, and clamps atu64::MAX/4for arithmetic safety.memory_capfield onGlobalBufferPoolConfigsoinit_global_buffer_poolcallsBufferPool::with_memory_cap, activating backpressure on the outstanding buffer total.run_client_internaland the server stdio entry point so both client and server enforce their own budgets, matching upstreamoptions.c:1943-1950.--max-alloc=Nto remote sender and daemon-server invocations and recognise it as a long server flag, matching upstreamoptions.c:2845-2846 server_options().--max-alloctoSUPPORTED_OPTIONS_LISTplus a help-text line documenting the suffix semantics.Test plan
cargo nextest run -p cli --all-features -E 'test(parse_max_alloc)'(CI)cargo nextest run -p cli --all-features -E 'test(server::tests)'(CI)cargo nextest run -p engine --all-features -E 'test(buffer_pool::global)'(CI)cargo nextest run -p core --all-features -E 'test(remote::invocation)'(CI)