rdblue commented on code in PR #9183:
URL: https://github.com/apache/iceberg/pull/9183#discussion_r1414618351
##########
core/src/main/java/org/apache/iceberg/BaseTransaction.java:
##########
@@ -446,20 +446,16 @@ private void commitSimpleTransaction() {
}
Set<String> committedFiles = committedFiles(ops, newSnapshots);
- if (committedFiles != null) {
- // delete all of the files that were deleted in the most recent set of
operation commits
- Tasks.foreach(deletedFiles)
- .suppressFailureWhenFinished()
- .onFailure((file, exc) -> LOG.warn("Failed to delete uncommitted
file: {}", file, exc))
- .run(
- path -> {
- if (!committedFiles.contains(path)) {
- ops.io().deleteFile(path);
- }
- });
- } else {
- LOG.warn("Failed to load metadata for a committed snapshot, skipping
clean-up");
- }
+ // delete all of the files that were deleted in the most recent set of
operation commits
+ Tasks.foreach(deletedFiles)
+ .suppressFailureWhenFinished()
+ .onFailure((file, exc) -> LOG.warn("Failed to delete uncommitted
file: {}", file, exc))
+ .run(
+ path -> {
+ if (committedFiles == null || !committedFiles.contains(path)) {
Review Comment:
I think this should actually change `committedFiles` to return
`ImmutableSet.of()` if there are no new snapshot IDs. The logic is correct to
warn if the other reason null is returned happens (a committed snapshot is
missing). `null` signals that the output of the method is invalid, which we
assumed was the case if there are no committed snapshots. But here we have a
case where it's a valid case to have no committed snapshots and therefore no
committed files.
--
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]