amogh-jahagirdar commented on code in PR #15126:
URL: https://github.com/apache/iceberg/pull/15126#discussion_r2900321370


##########
core/src/main/java/org/apache/iceberg/rest/CatalogHandlers.java:
##########
@@ -634,7 +635,16 @@ static TableMetadata commit(TableOperations ops, 
UpdateTableRequest request) {
 
                 // apply changes
                 TableMetadata.Builder metadataBuilder = 
TableMetadata.buildFrom(base);
-                request.updates().forEach(update -> 
update.applyTo(metadataBuilder));
+                try {
+                  request.updates().forEach(update -> 
update.applyTo(metadataBuilder));
+                } catch (RetryableValidationException e) {
+                  // Sequence number conflicts from concurrent commits are 
retryable by the client,
+                  // but server-side retry won't help since the sequence 
number is in the request.
+                  // Wrap in ValidationFailureException to skip server retry, 
return to client as
+                  // CommitFailedException so the client can retry with 
refreshed metadata.
+                  throw new ValidationFailureException(
+                      new CommitFailedException(e, "Commit conflict: %s", 
e.getMessage()));

Review Comment:
   I talked to @rdblue yesterday, I think we're now all on the same page that 
the current approach is best as is. We technically could explore other HTTP 
status codes (the best example I came up with is 412) but the problem is 
there's going to be all kinds of older clients that wouldn't be able to handle 
that but all those clients would indeed be able to handle 409s.  Kicking back a 
commit failed to a client with a 409 is probably the most general solution 
that's also not very intrusive.
   
   If we could update the tests (commented below), I think we'd be good to go 
ahead on this change.



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