You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2022/10/16 02:58:50 UTC

[GitHub] [iceberg] kbendick commented on a diff in pull request #5981: Core: Parallelize the determining of reachable manifests during file cleanup

kbendick commented on code in PR #5981:
URL: https://github.com/apache/iceberg/pull/5981#discussion_r996380125


##########
core/src/main/java/org/apache/iceberg/ReachableFileCleanup.java:
##########
@@ -84,19 +76,65 @@ public void cleanFiles(TableMetadata beforeExpiration, TableMetadata afterExpira
     deleteFiles(manifestListsToDelete, "manifest list");
   }
 
-  private Set<ManifestFile> readManifests(Set<Snapshot> snapshots) {
-    Set<ManifestFile> manifestFiles = Sets.newHashSet();
-    for (Snapshot snapshot : snapshots) {
-      try (CloseableIterable<ManifestFile> manifestFilesForSnapshot = readManifestFiles(snapshot)) {
-        for (ManifestFile manifestFile : manifestFilesForSnapshot) {
-          manifestFiles.add(manifestFile.copy());
-        }
-      } catch (IOException e) {
-        throw new RuntimeIOException(
-            e, "Failed to close manifest list: %s", snapshot.manifestListLocation());
-      }
+  private Set<ManifestFile> currentManifests(
+      Set<Snapshot> snapshots, Set<ManifestFile> manifestsToDelete) {
+    Set<ManifestFile> currentManifests = ConcurrentHashMap.newKeySet();
+    if (manifestsToDelete.isEmpty()) {
+      return currentManifests;

Review Comment:
   Correctness Question / Naming Nit -This seems somewhat odd to me. The way the function is used, this might produce correct results.
   
   But looking at the function name / signature directly and the first few lines of code, it's strange to return an empty set as the "current manifests" if the manifests to delete are empty.
   
   Generally speaking, that's not true to say that if there are no manifests to delete, there are no current manifests.
   
   Maybe the function needs to be renamed or the local variable name needs to be renamed?
   
   Again, the usage is very possibly correct, but the name of the function and logic in the base case of empty manifests seems off.
   
   Is it supposed to return an empty set when `snapshots` is empty?
   



-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org