ConeyLiu commented on code in PR #6335:
URL: https://github.com/apache/iceberg/pull/6335#discussion_r1277338905


##########
core/src/main/java/org/apache/iceberg/FastAppend.java:
##########
@@ -178,8 +178,28 @@ public Object updateEvent() {
 
   @Override
   protected void cleanUncommitted(Set<ManifestFile> committed) {
-    if (newManifest != null && !committed.contains(newManifest)) {
-      deleteFile(newManifest.path());
+    if (newManifests != null) {
+      // Delete newManifests that have not been committed and clear them from 
the list.

Review Comment:
   This is used to explain the above comments about why keep the `committed` 
here. I just noticed the doc in the parent class. Removed it since there is 
already an elaborate doc.



##########
core/src/main/java/org/apache/iceberg/FastAppend.java:
##########
@@ -178,8 +178,28 @@ public Object updateEvent() {
 
   @Override
   protected void cleanUncommitted(Set<ManifestFile> committed) {
-    if (newManifest != null && !committed.contains(newManifest)) {
-      deleteFile(newManifest.path());
+    if (newManifests != null) {
+      // Delete newManifests that have not been committed and clear them from 
the list.
+      // This is needed for manifests cleanup especially in transaction mode, 
for example:
+      //   Transaction txn = beginTransaction(...)
+      //
+      //   // Operation succeeds and calls cleanUncommitted
+      //   txn.newFastAppend().appendFile(...).commit();
+      //
+      //   // Some other operations ...
+      //
+      //   // Commit fails and needs to clean up newManifests
+      //   txn.commitTransaction()
+      List<ManifestFile> cleanedNewManifests = Lists.newArrayList();
+      for (ManifestFile manifestFile : newManifests) {
+        if (!committed.contains(manifestFile)) {

Review Comment:
   Updated.



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