Skip to content

Commit

Permalink
Do not scan manifests with no deletes when expiring. (#46)
Browse files Browse the repository at this point in the history
  • Loading branch information
rdblue committed Dec 12, 2018
1 parent c9d0f03 commit 61bc4ba
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions core/src/main/java/com/netflix/iceberg/RemoveSnapshots.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 61bc4ba

Please sign in to comment.