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

   ### What changes were proposed in this pull request?
   
   Two fixes in the retries of the Rust Spark Connect client core, from a 
review of #536 and #541:
   
   1. An abortable wait (`block_on_abortable`) now ends the retry backoffs of 
its future at the first interrupt of the execution in flight, as the other 
waits already do. Its drive enters an `AbortScope`, and `watched_abortable` 
sends `ABORT_RETRIES` when its watch returns `Interrupt`. Before, the interrupt 
was sent but a backoff inside the wait (for example the ReleaseSession release 
of a `stop()` called while an execution is in flight on the same thread, such 
as from a progress handler) slept in full.
   2. The first response of a reattachable execution now shares the retry 
budget of the first ExecutePlan, instead of starting a fresh one: the first RPC 
runs on a `Retrying` that the response stream keeps, and the first wait for a 
response takes it. Later waits keep their own budgets.
   
   ### Why are the changes needed?
   
   Both differ from PySpark 4.3.0 
(`python/pyspark/sql/connect/client/retries.py`, `reattach.py` and `core.py`). 
PySpark's retry sleep raises KeyboardInterrupt at the first signal. Its initial 
ExecutePlan has no retry of its own: its error surfaces in the first 
`_has_next`, whose single `Retrying` also covers the reattaches.
   
   Before the fix, with `max_retries=3`, an execution whose ExecutePlan fails 
twice and whose first response then fails made 3 ExecutePlan and 3 
ReattachExecute calls, 6 in all, where the policy allows 4. After it: 3 and 1.
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes, in retries: the first interrupt ends the retry backoff of an abortable 
wait, and an execution's first response is retried within the budget of its 
first request.
   
   ### How was this patch tested?
   
   New Rust unit tests, each checked to fail without the fix:
   - 
`test_an_interrupt_ends_the_backoff_of_an_abortable_wait_as_the_first_signal_does`
 (retries.rs): the backoff ends at the first interrupt; it timed out at 5 s 
without the fix. It also checks that a future without backoffs still returns 
its output after an interrupt.
   - `the_first_response_shares_the_attempts_of_the_first_rpc_as_pyspark` 
(client.rs, mock server): (ExecutePlan, ReattachExecute) calls are (3, 1), and 
were (3, 3) without the fix.
   
   The connect and connect-core lib tests, the connect-core integration tests, 
the Rust e2e suites and the Python drop-in offline and e2e suites (against 
Spark 4.3.0) pass, as do `cargo fmt`, `scripts/audit_no_stubs.sh` and ruff.
   
   ### 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