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


##########
core/src/main/java/org/apache/iceberg/BaseTransaction.java:
##########
@@ -474,6 +461,16 @@ private void commitSimpleTransaction() {
 
   private void cleanUpOnCommitFailure() {
     // the commit failed and no files were committed. clean up each update.
+    computeUncommittedFiles();
+
+    // delete all the uncommitted files
+    Tasks.foreach(deletedFiles)
+        .suppressFailureWhenFinished()
+        .onFailure((file, exc) -> LOG.warn("Failed to delete uncommitted file: 
{}", file, exc))
+        .run(ops.io()::deleteFile);
+  }
+
+  private void computeUncommittedFiles() {

Review Comment:
   The diff looks a bit strange, but  it's a bit of refactoring which separates
   
   1) computing the files to clean up via going through all the updates and 
calling `cleanAll` which enqueues the uncommitted files
   
   2.) Actually deleting the files
   
   I did this because in the code there a references to "cleaning up" but 
really what's happening is an enqueuing of possible files to cleanup after the 
commit succeeds or fails.



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