RussellSpitzer commented on code in PR #18477:
URL: https://github.com/apache/iceberg/pull/18477#discussion_r4527477004
##########
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:
There table isn't actually corrupted it just potentially has orphan files.
That's why expire snapshots is a little different than the other actions.
Unlike the other ones, expire snapshots is just about removing unnecessary
things and the worst case scenario with your change is some false negatives, we
find files that should be removed but don't remove them.
Every other action is about the current state of the table, if we can't
perform the action correctly the table is corrupt. There is no recovery.
--
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]