fix(services/etcd): make the gRPC decoding size limit configurable - #8193
fix(services/etcd): make the gRPC decoding size limit configurable#8193SatyamPandey-07 wants to merge 4 commits into
Conversation
etcd-client 0.19.0 caps decoded KV responses at 4 MiB regardless of what the etcd server itself allows, so a value the server accepted (e.g. an 8 MiB write with --max-request-bytes=10485760) fails to read back with "decoded message length too large". Add EtcdConfig::max_decoding_message_size and apply it via KvClient::max_decoding_message_size on reads. Also raise the CI fixtures' client-side limit to match the server's existing --max-request-bytes so the large-payload behavior tests can pass. Closes apache#8164.
The odev config generator also mirrors service config fields into the Java binding and website/data/services.json. Add the corresponding max_decoding_message_size entries there so `odev generate` produces no diff (the .NET config class already matched by hand in the prior commit).
|
Are there practical downsides of using larger decoding size? |
|
Thanks for the review @erickguan! Here is a breakdown of how the decoding size limit affects the client, server, and overall memory footprint: 1. Are there practical downsides of using a larger decoding size?
2. How does a typical etcd server respond differently with a larger response payload?
3. How does an etcd client allocate differently with a larger response size?
|
|
closed for no human in the loop. |
|
Hi @Xuanwo thanks for the clarification. I noticed PR #8193 was closed for “no human in the loop.” I had responded to @erickguan questions and also updated the branch with the latest main. If the approach still looks useful, should I reopen the PR or submit a new one for review? |
If you are the human, yes. If you are the agent or simply the meat proxy for agent, no. |
Which issue does this PR close?
Closes #8164.
Rationale for this change
services/etcdcan write a value larger than 4 MiB when the etcd serverallows it (the fixture configures
--max-request-bytes=10485760), but readingthat value back fails:
etcd-client0.19.0 applies its own 4 MiB gRPC decoding limit to KVresponses, independently of anything the etcd server allows. This is a
client-side response-size limit, so
Capability::write_total_max_sizecannotdescribe it, and until now
services/etcdgave no way to configure it.What changes are included in this PR?
core/services/etcd/src/config.rs: addEtcdConfig::max_decoding_message_size: Option<usize>, plus a unit test that it round-trips throughfrom_iter(so it can be set via
OPENDAL_ETCD_MAX_DECODING_MESSAGE_SIZEin thebehavior test harness and via URI options).
core/services/etcd/src/backend.rs: add the matchingEtcdBuilder::max_decoding_message_size(limit: usize)setter and thread thevalue into
EtcdCore::new.core/services/etcd/src/core.rs:EtcdCorenow carries the configuredlimit and applies it to
KvClientbefore issuing aget(
client.kv_client().max_decoding_message_size(limit)), instead of usingthe pooled
Client's default-limitedget. When unset, behavior isunchanged (etcd-client's own 4 MiB default applies) — this does not default
to an unbounded response size.
.github/services/etcd/{etcd,etcd-cluster,etcd-tls}/action.yml: setOPENDAL_ETCD_MAX_DECODING_MESSAGE_SIZE=10485760in all three CI fixtures,matching the
--max-request-bytes=10485760already configured on the etcdserver side in
fixtures/etcd/*.yml, so the existing 8 MiBReadBehavior_LargePayload_RoundTripsExactly(Async).NET behavior tests canpass against etcd.
bindings/dotnet/OpenDAL/ServiceConfig/EtcdServiceConfig.cs,bindings/java/src/main/java/org/apache/opendal/ServiceConfig.java,website/data/services.json: regenerated to add the newmax_decoding_message_sizefield to the generated per-language configclasses and the docs data.
I did not find an existing "temporary etcd-specific skip" on the large-payload
behavior test on
main(checkedbindings/dotnet/OpenDAL.Tests/Behavior/ReadBehaviorTest.cs, the CI matrixplanner at
.github/scripts/test_behavior/plan.py, and thedotnetbindingexclude list), so there was nothing to remove for that part of the issue's
acceptance criteria.
Are there any user-facing changes?
Yes:
Etcdnow accepts an optionalmax_decoding_message_sizeconfigoption/builder method. It's additive and opt-in — existing configurations
keep etcd-client's current 4 MiB read limit unless they explicitly raise it.
AI Usage Statement
AI materially assisted in writing this PR's code and description. I did not
have a Rust toolchain available to run
cargo build/test/clippyor theodevconfig generator locally, so the generated file updates(
EtcdServiceConfig.cs,ServiceConfig.java,website/data/services.json)were reproduced by hand against the generator's templates and verified
against this repo's own CI output rather than a local run.