eric-wang-1990 opened a new pull request, #3578:
URL: https://github.com/apache/arrow-adbc/pull/3578

   ## Summary
   Reordered HTTP delegating handlers in DatabricksConnection to ensure 
RetryHttpHandler processes responses before ThriftErrorMessageHandler throws 
exceptions. This fixes a bug where 503 Service Unavailable responses with 
Retry-After headers (e.g., during cluster auto-start) were not being retried.
   
   ## Problem
   Previously, the handler chain had ThriftErrorMessageHandler as the innermost 
handler:
   ```
   ThriftErrorMessageHandler (inner) → RetryHttpHandler (outer) → Network
   ```
   
   This caused ThriftErrorMessageHandler to process error responses first and 
throw exceptions immediately, preventing RetryHttpHandler from retrying 503 
responses during cluster auto-start scenarios.
   
   ## Solution
   Reordered the chain so RetryHttpHandler is inside ThriftErrorMessageHandler:
   ```
   RetryHttpHandler (inner) → ThriftErrorMessageHandler (outer) → Network
   ```
   
   Now responses flow: Network → RetryHttpHandler → ThriftErrorMessageHandler
   
   With this order:
   1. RetryHttpHandler processes 503 responses first and retries them according 
to Retry-After headers
   2. Only after all retries are exhausted does ThriftErrorMessageHandler throw 
exceptions with Thrift error messages
   
   ## Changes
   - Reordered handlers in `DatabricksConnection.CreateHttpHandler()`
   - Added comprehensive documentation explaining handler chain execution order 
and why it matters
   - Added cross-references in `RetryHttpHandlerTest` and 
`ThriftErrorMessageHandlerTest` pointing to the production code
   
   ## Test Plan
   - ✅ All existing unit tests pass:
     - `ThriftErrorMessageHandlerTest`: 11/11 tests pass
     - `RetryHttpHandlerTest`: 14/14 tests pass
   - The fix will be validated in E2E tests when connecting to Databricks 
clusters that need auto-start
   
   ## Related Issues
   Fixes cluster auto-start retry issues where 503 responses with Retry-After 
headers were not being retried.


-- 
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]

Reply via email to