hcrosse opened a new pull request, #2350:
URL: https://github.com/apache/iceberg-go/pull/2350

   Closes #2341.
   
   ## What
   
   I added `table.ErrCommitRejected` to distinguish a catalog rejection before 
any write from an unknown commit state. `Transaction.Commit` returns the 
rejection without retrying, cleans up files that it cannot reuse, and leaves 
the transaction committable. Conflicts still retry.
   
   I classify these failures as rejections:
   
   - SQL, Glue and Hive failures while preparing the new metadata, before 
writing it.
   - Hadoop failures while checking requirements or preparing the new metadata, 
before it creates the metadata directory.
   - REST commit responses 400, 401, 403 and 404, including those with 
undecodable bodies.
   
   Existing `errors.Is` matches keep working. SQL, Glue, Hive and Hadoop 
rejection messages gain a `commit rejected: ` prefix. REST messages keep their 
existing text first. REST 409 and 5xx responses are unchanged.
   
   I left `MultiTableTransaction` and REST `CommitTransaction` out of scope. 
Catalog read errors before the write and metadata write failures remain unknown 
state.
   
   ## Why
   
   Today, every non-conflict commit error counts as unknown state. Cleanup is 
skipped and the transaction refuses another `Commit`, even when nothing was 
written.
   
   This is the Go equivalent of Java's 
[`CleanableFailure`](https://github.com/apache/iceberg/blob/6275107e38cc87a7d416ef231019ceb51556f196/api/src/main/java/org/apache/iceberg/exceptions/CleanableFailure.java#L21-L25).
 Java throws exceptions that implement that interface for [404 in the commit 
handler](https://github.com/apache/iceberg/blob/6275107e38cc87a7d416ef231019ceb51556f196/core/src/main/java/org/apache/iceberg/rest/ErrorHandlers.java#L119-L139)
 and [400, 401 and 403 in the default 
handler](https://github.com/apache/iceberg/blob/6275107e38cc87a7d416ef231019ceb51556f196/core/src/main/java/org/apache/iceberg/rest/ErrorHandlers.java#L334-L345).
   
   I treat every REST 400 as a rejection, while Java doesn't mark a 400 with 
the error type `IllegalArgumentException` as cleanable. I also keep staged 
files so callers can commit again, whereas [Java cleans up all transaction 
updates](https://github.com/apache/iceberg/blob/6275107e38cc87a7d416ef231019ceb51556f196/core/src/main/java/org/apache/iceberg/BaseTransaction.java#L378-L382).
   
   ## Testing
   
   I added transaction, catalog and end-to-end tests. Each new test fails when 
I revert the classification that it covers. The full suite, race tests for 
`table` and `catalog`, and lint pass.
   


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