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

   ### What changes were proposed in this pull request?
   
   [SPARK-61149](https://issues.apache.org/jira/browse/SPARK-61149): the 
retries of the client follow PySpark's `RetryPolicyState`, `_call_iter` and the 
config read of an error.
   
   - `RetryPolicyState::next_attempt` checks only `max_retries`, as PySpark's 
`RetryPolicyState.next_attempt` does. The elapsed-time bound (one hour by 
default) stays on the retries that PySpark makes as `RetryException`s: the 
deadlines, and the reattaches to an unknown execution, which the client checks 
with `retry_exception_bound_passed`.
   - A reattach that finds the session or the operation unknown 
(`INVALID_HANDLE.SESSION_NOT_FOUND` as well as 
`INVALID_HANDLE.OPERATION_NOT_FOUND`) sends the ExecutePlan again when no 
response was read. Once a response was read, it raises 
`RESPONSE_ALREADY_RECEIVED` (`PySparkRuntimeError`, with `error_type` set to 
the code), as PySpark's `_call_iter` does. Before, only the operation code was 
handled, and after a response it surfaced the server error.
   - The config read that shows the stack trace of a server error is bounded by 
`rpc_deadlines.config`, as PySpark's `RuntimeConf.get` is. Before, a connection 
that never answered hung the call that should raise the error.
   
   ### Why are the changes needed?
   
   - A transient `UNAVAILABLE` on a reattach more than one hour into a single 
`message()` call failed at once, with retries left in the policy, because 
`next_attempt` checked the RetryException bound too.
   - A reattach after a response, to an execution whose session the server no 
longer knows, raised the server's `INVALID_HANDLE.SESSION_NOT_FOUND` error, 
where PySpark raises `RESPONSE_ALREADY_RECEIVED`. Before any response, the 
execution was not sent again.
   - Raising a server error with stack-trace details sent an unbounded `Config` 
call.
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes, in error cases only: a policy retry is no longer cut by the one-hour 
bound, an unknown session after a response raises `PySparkRuntimeError` with 
`RESPONSE_ALREADY_RECEIVED` (as PySpark), and a server error no longer waits 
forever on the config read.
   
   ### How was this patch tested?
   
   - Rust `test_elapsed_time_ceiling_does_not_cut_policy_retries` and 
`test_policy_retries_after_the_elapsed_bound_until_max_retries` in `retries.rs` 
(the policy keeps its `max_retries` budget past the elapsed bound).
   - Rust `policy_retry_of_a_reattach_is_not_cut_by_the_retry_exception_bound` 
in `deadlines.rs`: a reattach that fails with `UNAVAILABLE` is retried under a 
zero RetryException bound and returns the results.
   - Rust `session_not_found_before_any_response_resends_the_execute_plan` in 
`deadlines.rs`: the ExecutePlan is sent again, and its results are returned.
   - Rust `session_not_found_after_a_response_is_response_already_received` and 
`session_not_found_in_the_reattach_call_after_a_response_is_response_already_received`,
 and the updated 
`operation_not_found_after_a_response_is_the_error_and_is_not_resent`: 
`RESPONSE_ALREADY_RECEIVED` with the matched `error_type`, and no second 
ExecutePlan.
   - Rust `error_of_a_server_with_details_bounds_the_config_read` in 
`deadlines.rs`: the error is raised with a `Config` call that carries its 
`grpc-timeout`, while the config does not answer.
   - The tests of both crates, e2e included, against a local Spark 4.3.0 server 
(881 passed), the build of all tests, also with `wasm-udf`, the offline Python 
suites (2201 passed, 8 skipped), and the live drop-in, Arrow and ML suites (184 
passed) and live cases (10 passed). rustfmt passes, and 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