ChristinaTech commented on code in PR #7198:
URL: https://github.com/apache/iceberg/pull/7198#discussion_r1157377212


##########
aws/src/main/java/org/apache/iceberg/aws/dynamodb/DynamoDbTableOperations.java:
##########
@@ -116,20 +118,30 @@ protected void doCommit(TableMetadata base, TableMetadata 
metadata) {
                   .build());
       checkMetadataLocation(table, base);
       Map<String, String> properties = prepareProperties(table, 
newMetadataLocation);
-      persistTable(tableKey, table, properties);
+      persistTable(tableKey, table, properties, retryDetector);
       commitStatus = CommitStatus.SUCCESS;
-    } catch (ConditionalCheckFailedException e) {
-      throw new CommitFailedException(
-          e, "Cannot commit %s: concurrent update detected", tableName());
     } catch (CommitFailedException e) {
       // any explicit commit failures are passed up and out to the retry 
handler
       throw e;
     } catch (RuntimeException persistFailure) {
-      LOG.error(
-          "Confirming if commit to {} indeed failed to persist, attempting to 
reconnect and check.",
-          fullTableName,
-          persistFailure);
-      commitStatus = checkCommitStatus(newMetadataLocation, metadata);
+      boolean conditionCheckFailed = persistFailure instanceof 
ConditionalCheckFailedException;
+
+      // If we got an exception we weren't expecting, or we got a 
ConditionalCheckFailedException
+      // but retries were performed, attempt to reconcile the actual commit 
status.
+      if (!conditionCheckFailed || retryDetector.retried()) {
+        LOG.error(
+            "Confirming if commit to {} indeed failed to persist, attempting 
to reconnect and check.",
+            fullTableName,
+            persistFailure);
+        commitStatus = checkCommitStatus(newMetadataLocation, metadata);
+      }
+
+      // If we got ConditionalCheckFailedException, but find we
+      // succeeded on a retry that threw an exception, skip this exception.

Review Comment:
   If the comment risks causing more confusion than helping, I'll just remove 
it.



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