rdblue commented on a change in pull request #928: Add failure handling in 
cleanup while reading snapshot manifest-list files
URL: https://github.com/apache/incubator-iceberg/pull/928#discussion_r409188087
 
 

 ##########
 File path: core/src/main/java/org/apache/iceberg/RemoveSnapshots.java
 ##########
 @@ -201,112 +201,121 @@ private void cleanExpiredFiles(List<Snapshot> 
snapshots, Set<Long> validIds, Set
     // find manifests to clean up that are still referenced by a valid 
snapshot, but written by an expired snapshot
     Set<String> validManifests = Sets.newHashSet();
     Set<ManifestFile> manifestsToScan = Sets.newHashSet();
-    for (Snapshot snapshot : snapshots) {
-      try (CloseableIterable<ManifestFile> manifests = 
readManifestFiles(snapshot)) {
-        for (ManifestFile manifest : manifests) {
-          validManifests.add(manifest.path());
-
-          long snapshotId = manifest.snapshotId();
-          // whether the manifest was created by a valid snapshot (true) or an 
expired snapshot (false)
-          boolean fromValidSnapshots = validIds.contains(snapshotId);
-          // whether the snapshot that created the manifest was an ancestor of 
the table state
-          boolean isFromAncestor = ancestorIds.contains(snapshotId);
-          // whether the changes in this snapshot have been picked into the 
current table state
-          boolean isPicked = pickedAncestorSnapshotIds.contains(snapshotId);
-          // if the snapshot that wrote this manifest is no longer valid (has 
expired), then delete its deleted files.
-          // note that this is only for expired snapshots that are in the 
current table state
-          if (!fromValidSnapshots && (isFromAncestor || isPicked) && 
manifest.hasDeletedFiles()) {
-            manifestsToScan.add(manifest.copy());
-          }
-        }
-
-      } catch (IOException e) {
-        throw new RuntimeIOException(e,
-            "Failed to close manifest list: %s", 
snapshot.manifestListLocation());
-      }
-    }
+    Tasks.foreach(snapshots).noRetry().suppressFailureWhenFinished()
+        .onFailure((snapshot, exc) -> LOG.warn("Failed on snapshot {} while 
reading manifest list: {}",
 
 Review comment:
   This indentation seems a bit awkward to me because the arguments are 
indented so much less than the `LOG.warn` call. What about moving `LOG.warn` to 
the next line and indenting its arguments to make it obvious what the args are 
passed to?

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