diff --git a/core/src/main/java/com/netflix/iceberg/RemoveSnapshots.java b/core/src/main/java/com/netflix/iceberg/RemoveSnapshots.java index f3462df92..bdb223c72 100644 --- a/core/src/main/java/com/netflix/iceberg/RemoveSnapshots.java +++ b/core/src/main/java/com/netflix/iceberg/RemoveSnapshots.java @@ -159,8 +159,11 @@ public void commit() { .onFailure((item, exc) -> LOG.warn("Failed to get deleted files: this may cause orphaned data files", exc) ).run(manifest -> { - // even if the manifest is still used, it may contain files that can be deleted - // TODO: eliminate manifests with no deletes without scanning + if (manifest.deletedFilesCount() != null && manifest.deletedFilesCount() == 0) { + return; + } + + // the manifest has deletes, scan it to find files to delete try (ManifestReader reader = ManifestReader.read(ops.io().newInputFile(manifest.path()))) { for (ManifestEntry entry : reader.entries()) { // if the snapshot ID of the DELETE entry is no longer valid, the data can be deleted