agnes-xinyi-lu commented on code in PR #15126:
URL: https://github.com/apache/iceberg/pull/15126#discussion_r2791499531


##########
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:
   @rdblue this exception is only retryable on the client side, server side 
retries will not help because snapshot is provided by the client side. 
   If we want to change `SnapshotProducer` to retry on this 
`RetryableValidationException`, then should we create a different status code 
in the SPEC other than 
[409](https://github.com/apache/iceberg/blob/f49b2fd97b48682d4e4ca6f1a552cb48f53c4ea5/open-api/rest-catalog-open-api.yaml#L1068)
 which is CommitFailedException? Or should we keep the wrapping of 
CommitFailedException(but update message to something more specific like 
`Retryable validation failure`) and avoid the spec 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