wangyum opened a new issue, #17307:
URL: https://github.com/apache/iceberg/issues/17307
### Apache Iceberg version
1.11.0 (latest release)
### Query engine
Spark
### Please describe the bug 🐞
## Background
Commit `de4101118` (PR #15006) introduced duplicate DV detection and merging
in `MergingSnapshotProducer.mergeDVs()`. Each time `mergeDVs()` is invoked, it
writes a new Puffin file (e.g. `merged-dvs-<snapshotId>-<n>.puffin`).
The delete manifests produced by `newDeleteFilesAsManifests()` are cached.
When the cache is invalidated (a subsequent `addDeletes` call sets
`hasNewDeleteFiles=true`), the code only deletes the cached **manifest** files
but leaves the **Puffin** file produced by the previous `mergeDVs()` call
orphaned on disk.
The same orphan occurs on **commit failure**: `cleanUncommittedAppends`
deletes uncommitted delete manifests but never deletes the Puffin files they
referenced.
## Reproducer
```
RowDelta.addDeletes(dv1, dv2) → apply()
// writes merged-dvs-...-1.puffin, caches delete manifests
→ addDeletes(dv3)
// invalidates cache: deletes manifest, but puffin file is orphaned
→ commit()
```
## Impact
Resource leak — orphaned Puffin files accumulate in the table's data
directory and can only be removed by `remove_orphan_files`. Does not corrupt
committed data; read correctness is preserved.
### Willingness to contribute
- [x] I can contribute a fix for this bug independently
- [ ] I would be willing to contribute a fix for this bug with guidance from
the Iceberg community
- [ ] I cannot contribute a fix for this bug at this time
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]