HyukjinKwon opened a new pull request, #415:
URL: https://github.com/apache/spark-connect-rust/pull/415

   ### What changes were proposed in this pull request?
   
   [SPARK-61234](https://issues.apache.org/jira/browse/SPARK-61234): apply the 
gRPC keepalive of the connection string to the channel, as PySpark does, and 
redact the token in the `Debug` of `ChannelBuilder`.
   
   - The channel (both the TLS and the plaintext endpoint) now sends HTTP2 
keepalive PINGs as PySpark's `ChannelBuilder._effective_channel_options` 
configures gRPC (SPARK-58094): `grpc.keepalive_time_ms` (default 60 s), 
`grpc.keepalive_timeout_ms` (default 20 s) and 
`grpc.keepalive_permit_without_calls` (default on) become tonic's 
`http2_keep_alive_interval`, `keep_alive_timeout` and `keep_alive_while_idle`. 
With `grpc_keepalive_enabled=false`, as in PySpark, none is set. The new 
`ChannelBuilder::keepalive()` gives the settings (`None` when off, or for a 
time that is not positive).
   - The `Debug` of the public `ChannelBuilder` was derived and printed the 
token of the connection string (`params: {"token": "SECRET"}`). It now shows 
the values of `token` and of an `authorization` param as `<redacted>`; the 
other params, the host and the port as before.
   
   The Spark 4.3.0 server tolerates client PINGs as often as every 10 s 
regardless of its own keepalive settings (`spark.connect.grpc.keepAlive.*`), so 
that a client with PySpark's default-on keepalive is never rejected with 
`too_many_pings`.
   
   ### Why are the changes needed?
   
   The keepalive params were parsed (`ChannelBuilder::keepalive_*`, and 
`dev/parity/inventory.csv` lists them as done) but never applied: the tonic 
channel had only a connect timeout. A connection that a NAT gateway or load 
balancer drops without a TCP RST/FIN then leaves a blocked call, such as a long 
`collect` or `awaitTermination`, waiting forever, where PySpark's PINGs fail it 
with `UNAVAILABLE`, which is retried or reattached. And 
`format!("{builder:?}")` put the token into logs.
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes. The Rust client and the Python drop-in send keepalive PINGs as PySpark 
does, configurable with the same connection-string params, and 
`ChannelBuilder`'s `Debug` no longer shows the token.
   
   ### How was this patch tested?
   
   - New unit tests in `crates/spark-connect-core/src/channel.rs`: 
`keepalive_is_that_of_the_channel_options_of_pyspark` (PySpark's defaults, 
overrides, turned off, a zero time, and that the params are not request 
metadata) and `debug_of_a_builder_redacts_its_token`.
   - The tests of the transport crate (188 passed) and the live Rust 
`e2e_integration` tests (17 passed), with the keepalive on, against a local 
Spark 4.3.0 server.
   - The lib tests of both crates (666 passed), the build of all tests, also 
with `wasm-udf`, the offline Python suites (2819 passed, 8 skipped), and the 
live drop-in and Arrow suites (233 passed) and live cases (13 passed) against a 
local Spark 4.3.0 server. Clippy reports no diagnostics in the changed lines.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   Generated-by: Claude Opus 5.5
   
   This pull request and its description were written by Isaac.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to