rdblue commented on a change in pull request #675: Inherit snapshot ids for 
manifest entries
URL: https://github.com/apache/incubator-iceberg/pull/675#discussion_r370763037
 
 

 ##########
 File path: core/src/main/java/org/apache/iceberg/MergingSnapshotProducer.java
 ##########
 @@ -381,9 +404,19 @@ private void cleanUncommittedAppends(Set<ManifestFile> 
committed) {
       this.cachedNewManifest = null;
     }
 
-    for (ManifestFile manifest : appendManifests) {
-      if (!committed.contains(manifest)) {
-        deleteFile(manifest.path());
+    // the clean-up logic depends on whether we append original manifests or 
their copies
+    // 1) if we rewrite manifests before appending them
+    //    we need to delete all uncommitted copies of manifests to prevent 
orphan metadata files
+    //    as the caller doesn't have access to them
+    // 2) if we append original manifests without rewriting them and the 
commit succeeds
+    //    we need to delete appended manifests that are merged with others 
while preparing a new snapshot
+    //    otherwise, the caller will have to find which appended manifests 
were merged but not committed
+    //    to prevent orphan metadata files
+    if (!snapshotIdInheritanceEnabled || !committed.isEmpty()) {
 
 Review comment:
   I was wrong: there's one case where we need to avoid cleanup: when the 
commit failed and inheritance is enabled.
   
   I think that explains the check here. If inheritance is not enabled or if 
the committed list is empty, then we know that is not the case. The logic here 
is difficult to follow, even with the comments, but I think it is correct.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to