hcrosse opened a new pull request, #913: URL: https://github.com/apache/arrow-rs-object-store/pull/913
# Which issue does this PR close? Closes #912. # Rationale for this change [`HttpError::reqwest`](https://github.com/apache/arrow-rs-object-store/blob/c216edef0ac3d0d39da5bcdfeed3dcd034e26597/src/client/http/connection.rs#L122-L128) classified `hyper::Error::is_incomplete_message()` as `HttpErrorKind::Request`, causing [`RetryableRequest::send`](https://github.com/apache/arrow-rs-object-store/blob/c216edef0ac3d0d39da5bcdfeed3dcd034e26597/src/client/retry.rs#L457-L463) to retry even non idempotent requests after an EOF while waiting for response headers. Because `IncompleteMessage` cannot distinguish a server closing an idle connection after write from a server closing after committing a request, retrying a non idempotent `PutMode::Create` (`If-None-Match: *`) turns a lost response into `412 Precondition Failed` (`Error::AlreadyExists`). Classifying `is_incomplete_message()` as `HttpErrorKind::Interrupted` aligns it with `std::io::ErrorKind::UnexpectedEof` and `ConnectionReset` in the same function: safe methods and explicitly idempotent writes (`PutMode::Overwrite`) still retry, while non idempotent writes fail with `HttpErrorKind::Interrupted`. # What changes are included in this PR? - Map `hyper::Error::is_incomplete_message()` to `HttpErrorKind::Interrupted` in [`HttpError::reqwest`](https://github.com/apache/arrow-rs-object-store/blob/c216edef0ac3d0d39da5bcdfeed3dcd034e26597/src/client/http/connection.rs#L122-L128), keeping `is_closed()` and `is_body_write_aborted()` under `HttpErrorKind::Request`. - Update the existing retry unit test expectation in [`src/client/retry.rs`](https://github.com/apache/arrow-rs-object-store/blob/c216edef0ac3d0d39da5bcdfeed3dcd034e26597/src/client/retry.rs#L803) from `HttpErrorKind::Request` to `HttpErrorKind::Interrupted` and add unit tests verifying that `IncompleteMessage` retries idempotent requests (`GET` and `.idempotent(true)` `PUT`) without retrying non idempotent `PUT` requests. - Add an `AmazonS3` unit test in `src/aws/mod.rs` verifying that `PutMode::Create` does not retry on a connection close after receiving the request (returning `Error::Generic` with `HttpErrorKind::Interrupted` rather than `Error::AlreadyExists`) while `PutMode::Overwrite` still retries. # Are there any user-facing changes? Yes. `HttpError::kind()` now reports `HttpErrorKind::Interrupted` instead of `HttpErrorKind::Request` for `hyper::Error::is_incomplete_message()`, so non idempotent requests (such as `PutMode::Create` and `PutMode::Update`) are no longer automatically retried when a connection closes before response headers arrive. Safe requests and idempotent writes (`PutMode::Overwrite`) keep retrying as before. -- 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]
