luma-shangma opened a new pull request, #929:
URL: https://github.com/apache/arrow-rs-object-store/pull/929

   # Which issue does this PR close?
   
   Closes #901.
   
   # Rationale for this change
   
   After the HTTP retry budget is exhausted, callers currently receive 
`Error::Generic` for both explicit throttling and unrelated failures such as 
connection errors or ordinary 5xx responses. Rate-adaptive callers therefore 
have to inspect formatted error text, which loses the distinction they need.
   
   The provider client is the right place to classify throttling: it still has 
the HTTP status and the structured provider error code. Downstream callers 
should receive that decision as part of the error type instead of 
reconstructing it from `Display` output.
   
   # What changes are included in this PR?
   
   - Add `Error::Throttled { path, source }`.
   - Classify HTTP 429 as throttling.
   - Classify HTTP 503 only when its structured error code is `SlowDown` or 
`ServerBusy`.
   - Preserve throttling errors returned in successful S3 response bodies.
   - Propagate the typed error through S3, Azure, and GCS list requests, Azure 
bulk delete, and GCS multipart completion.
   - Keep bodyless 503s, ordinary 500s, and transport failures as their 
existing generic errors.
   
   The provider-specific tests cover the paths above, including malformed 
bodies and messages that merely contain throttle-related words.
   
   # How was this tested?
   
   On this commit:
   
   - `cargo fmt --all -- --check`
   - `cargo clippy --all-targets --all-features -- -D warnings`
   - `cargo test --all-features` (272 unit tests, all integration tests, and 57 
doctests passed; 8 tests ignored)
   - `cargo doc --all-features --no-deps`
   
   I also built Lance against this change and ran a controlled S3-compatible 
canary. The rate started at 100 requests/second; a confirmed throttle should 
halve it, while a generic failure should leave it unchanged. “Requests” 
includes the retry performed by Lance after the object-store client's own retry 
budget was exhausted.
   
   | Response | Before | With this change |
   |---|---|---|
   | HTTP 200 | 1 request, rate 100 | 1 request, rate 100 |
   | HTTP 429 | 2 requests, rate 50 | 2 requests, rate 50 |
   | HTTP 503 with `SlowDown` | 2 requests, rate 50 | 2 requests, rate 50 |
   | Bodyless HTTP 503 | 2 requests, rate 50 | 1 request, surfaced error, rate 
100 |
   | Ordinary HTTP 500 after one client retry | 3 requests, rate 50 | 2 
requests, surfaced error, rate 100 |
   
   This keeps the existing throttle behavior while avoiding an extra outer 
retry and AIMD reduction for failures that were not throttle signals.
   
   As a final compatibility check, baseline and patched Lance wheels read the 
same Lance table through an S3-compatible cache. Both returned 25 rows and one 
fragment, with identical schema and sampled payload hashes.
   
   # Are there any user-facing changes?
   
   Yes. Confirmed throttling failures now use the new `Error::Throttled` 
variant instead of `Error::Generic`. `Error` is already `#[non_exhaustive]`.
   


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