Xuanwo commented on issue #8584:
URL: https://github.com/apache/opendal/issues/8584#issuecomment-7067231068

   Thanks for the thorough write-up on ambiguous post-commit retries.
   
   Rather than replaying a second HTTP request and rewriting `412` / `404` into 
`Unexpected` after the fact, we prefer **stopping automatic retries once a 
state-changing request may already have committed** unless the protocol 
provides server-side idempotency deduplication (as in GCS #8517) or session 
reconciliation (as in GCS #8199). Replaying first still risks creating 
duplicate versions or a second unintended mutation if the replay succeeds, and 
a single handle-level flag breaks down across `S3Deleter` batch items or 
`SlowDown` on a second attempt.
   
   For `services/s3`, the contract we want to validate first is:
   
   - **Scope:** S3 conditional mutations (`if_not_exists`, `if_match`, 
`delete_with().if_match()`, conditional copy, conditional append at offset 0) 
and `CompleteMultipartUpload` (write and copy). Unconditional `PutObject` / 
`CopyObject` / `DeleteObject` and `UploadPart` / `CreateMultipartUpload` / 
`AbortMultipartUpload` keep existing retry behavior unchanged.
   - **Error & retry behavior:**
     - Definite first-attempt rejections (`412`, conditional delete `404`, 
`409`) keep returning `ConditionNotMatch` / `Conflict`.
     - Definite pre-commit rejections (credential/signing failure, `429` / 
`SlowDown` / `TooManyRequests`, `PutObject` `ConditionalRequestConflict`) 
remain `temporary` and retry normally.
     - Once an attempt enters an ambiguous outcome (5xx, transport error, or 
`TimeoutLayer` cancellation), stop automatic retries and return a permanent 
`ErrorKind::Unexpected` preserving the original error and context — without 
sending a second HTTP request.
   - **Implementation boundary (v1 in `services/s3` only):**
     - Keep `Error`, `HttpTransport`, and `RetryLayer` public contracts 
unchanged.
     - Conservative fallback to permanent `Unexpected` on DNS/TCP connect 
failures or `TimeoutLayer` cancellation while queued is acceptable for v1.
     - Note the `TimeoutLayer`-inside-`RetryLayer` path: when `TimeoutWrapper` 
drops the S3 future and returns a temporary timeout directly to `RetryLayer`, 
S3's own error handler does not run. Tracking a minimal uncertain state in S3 
(set when entering `http_transport().send()`, cleared on a definite response, 
and scoped per item/batch in `S3Deleter` so unrelated entries are not affected) 
lets S3 refuse a re-entrant retry before issuing a second HTTP request and 
return permanent `Unexpected`.
   - **Rollout:** Validate on real AWS S3 first (single conditional mutation, 
`CompleteMultipartUpload` lost-response path, and pre-commit rejection codes) 
and land in `services/s3`. Once that is verified, we can evaluate updating 
`core/core/src/docs/specs/conditional-operations.md` and extending the same 
rule to other services without idempotency tokens (such as `azblob`).
   
   *(This comment was generated by AI.)*
   


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