Skip to content

Commit

Permalink
SnapshotProducer: Fixed trying to delete an already deleted file duri…
Browse files Browse the repository at this point in the history
…ng cleanup
  • Loading branch information
jasonf20 committed Dec 14, 2023
1 parent 2650e8f commit f92bef9
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions core/src/main/java/org/apache/iceberg/SnapshotProducer.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import com.github.benmanes.caffeine.cache.LoadingCache;
import java.io.IOException;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
Expand Down Expand Up @@ -427,9 +428,12 @@ public void commit() {
if (saved != null) {
cleanUncommitted(Sets.newHashSet(saved.allManifests(ops.io())));
// also clean up unused manifest lists created by multiple attempts
for (String manifestList : manifestLists) {
if (!saved.manifestListLocation().equals(manifestList)) {
deleteFile(manifestList);
Iterator<String> manifestListIterator = manifestLists.iterator();
while (manifestListIterator.hasNext()) {
String location = manifestListIterator.next();
if (!saved.manifestListLocation().equals(location)) {
deleteFile(location);
manifestListIterator.remove();
}
}
} else {
Expand Down Expand Up @@ -487,11 +491,7 @@ protected void cleanAll() {
}

protected void deleteFile(String path) {
try {
deleteFunc.accept(path);
} catch (RuntimeIOException ignored) {
// Allow other deletes to run even if this one fails
}
deleteFunc.accept(path);
}

protected OutputFile manifestListPath() {
Expand Down

0 comments on commit f92bef9

Please sign in to comment.