ajantha-bhat commented on code in PR #8909:
URL: https://github.com/apache/iceberg/pull/8909#discussion_r1376297916


##########
nessie/src/main/java/org/apache/iceberg/nessie/NessieTableOperations.java:
##########
@@ -135,71 +135,26 @@ protected void doCommit(TableMetadata base, TableMetadata 
metadata) {
     boolean newTable = base == null;
     String newMetadataLocation = writeNewMetadataIfRequired(newTable, 
metadata);
 
-    String refName = client.refName();
-    boolean failure = false;
+    AtomicBoolean failure = new AtomicBoolean(false);
     try {
       String contentId = table == null ? null : table.getId();
       client.commitTable(base, metadata, newMetadataLocation, contentId, key);
-    } catch (NessieConflictException ex) {
-      failure = true;
-      if (ex instanceof NessieReferenceConflictException) {
-        // Throws a specialized exception, if possible
-        maybeThrowSpecializedException((NessieReferenceConflictException) ex);
+    } catch (NessieConflictException | NessieNotFoundException | 
HttpClientException ex) {
+      NessieUtil.handleExceptionsForCommits(ex, client.refName(), failure);
+    } catch (NessieBadRequestException ex) {

Review Comment:
   That particular testcase is tricky because `createTransaction()` will call 
`refresh()` which already has code to check if any other content exist with the 
same name. But during `commitTransaction()` it will not call `refresh()` so 
that code is never hit and we need to check again if any new content created 
with same key concurrently. 
   
   So, I have added that logic now instead of catching 
`NessieBadRequestException` later on.
   
   I am not sure about `memorize` commit hash solution. Last time (some other 
PR) we concluded that we need to be as stateless as possible. Lets see what 
others think. 



-- 
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: issues-unsubscr...@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to