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_r370761044
 
 

 ##########
 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:
   `appendManifests` always contains manifests that are owned by the table. If 
inheritance is not enabled, then the manifest is rewritten before it is added 
to appendManifests, and if it is enabled then the table takes ownership of the 
manifest.
   
   So it should always be okay to clean up `appendManifests` using the 
committed list here, regardless of the inheritance setting.

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