RussellSpitzer commented on code in PR #18477:
URL: https://github.com/apache/iceberg/pull/18477#discussion_r4515245191
##########
spark/v4.2/spark/src/main/java/org/apache/iceberg/spark/actions/ExpireSnapshotsSparkAction.java:
##########
@@ -222,10 +230,24 @@ private String jobDesc() {
}
private ExpireSnapshots.Result doExecute() {
- if (streamResults()) {
- return deleteFiles(expireFiles().toLocalIterator());
- } else {
- return deleteFiles(expireFiles().collectAsList().iterator());
+ Dataset<FileInfo> expiredFiles = expireFiles();
+ Iterator<FileInfo> filesToDelete =
+ streamResults() ? expiredFiles.toLocalIterator() :
expiredFiles.collectAsList().iterator();
+ ExpireSnapshots.Result result = deleteFiles(filesToDelete);
+ failIfMissingMetadata();
Review Comment:
This is a bit of a different behavior than before. We're now failing even
though the expiration committed and most of the files were correctly removed,
and the caller loses the `Result` with the counts of what we actually deleted.
Retrying doesn't help either, since the expired snapshots are already gone from
metadata.
I think we should return the `Result` for the work we did and just log the
skipped metadata. That's consistent with how this action already handles delete
failures (`deleteFiles` suppresses them and logs), with `DeleteOrphanFiles`,
and with `RewriteDataFiles` under partial progress, which all report OK and log
or report the failures. Anything we couldn't clean up here will get picked up
by orphan file cleanup anyway.
--
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]