Fokko commented on code in PR #9354:
URL: https://github.com/apache/iceberg/pull/9354#discussion_r1434520886
##########
core/src/main/java/org/apache/iceberg/MergingSnapshotProducer.java:
##########
@@ -892,15 +892,18 @@ private void cleanUncommittedAppends(Set<ManifestFile>
committed) {
}
}
- ListIterator<ManifestFile> deleteManifestsIterator =
cachedNewDeleteManifests.listIterator();
- while (deleteManifestsIterator.hasNext()) {
- ManifestFile deleteManifest = deleteManifestsIterator.next();
- if (!committed.contains(deleteManifest)) {
- deleteFile(deleteManifest.path());
- deleteManifestsIterator.remove();
+ boolean hasDeleteDeletes = false;
+ for (ManifestFile cachedNewDeleteManifest : cachedNewDeleteManifests) {
+ if (!committed.contains(cachedNewDeleteManifest)) {
+ deleteFile(cachedNewDeleteManifest.path());
+ hasDeleteDeletes = true;
Review Comment:
I also looked at that. I think it is for performance reasons since
`writer.toManifestFiles();` returns a `list`. For the deletes, we do a `addAll`
which is in `O(n)`. I'm a bit torn, I like the performance optimization, but in
practice, I don't think that we write that many manifests, so `n` is rather
small. Therefore I prefer avoiding nulling it out to make the code easier to
read.
--
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]