huaxingao commented on code in PR #14320:
URL: https://github.com/apache/iceberg/pull/14320#discussion_r2433895758


##########
core/src/main/java/org/apache/iceberg/rest/RESTTableOperations.java:
##########
@@ -155,20 +157,86 @@ public void commit(TableMetadata base, TableMetadata 
metadata) {
     // the error handler will throw necessary exceptions like 
CommitFailedException and
     // UnknownCommitStateException
     // TODO: ensure that the HTTP client lib passes HTTP client errors to the 
error handler
-    LoadTableResponse response =
-        client.post(path, request, LoadTableResponse.class, headers, 
errorHandler);
+    LoadTableResponse response;
+    try {
+      response = client.post(path, request, LoadTableResponse.class, headers, 
errorHandler);
+    } catch (CommitStateUnknownException e) {
+      // Lightweight reconciliation for snapshot-add-only updates on transient 
unknown commit state
+      if (updateType == UpdateType.SIMPLE && reconcileOnSimpleUpdate(updates, 
e)) {
+        return;
+      }
+
+      throw e;
+    }
 
     // all future commits should be simple commits
     this.updateType = UpdateType.SIMPLE;
 
     updateCurrentMetadata(response);

Review Comment:
   In the reconciliation branch we call `refresh()`, which internally calls 
`updateCurrentMetadata`. That's why we intentionally skip calling 
`updateCurrentMetadata` again.



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