Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add interfaces for Action RemoveExpiredFiles #10643

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

huaxingao
Copy link
Contributor

Co-authored-by: Yufei Gu yufei@apache.org
Co-authored-by: Huaxin Gao huaxin_gao@apple.com

This PR adds interfaces for Action RemoveExpiredFiles. We will have another PR to implement the interfaces in Spark 3.4 and Spark 3.5.

Co-authored-by: Yufei Gu <yufei@apache.org>
@@ -70,4 +70,10 @@ default RewritePositionDeleteFiles rewritePositionDeletes(Table table) {
throw new UnsupportedOperationException(
this.getClass().getName() + " does not implement rewritePositionDeletes");
}

/** Instantiates an action to remove expired files. */
default RemoveExpiredFiles removeExpiredFiles(Table table) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@huaxingao: Can you please provide more background about why this interface is needed and what spark action we are planning to build on top of it? As per me, expireSnapshots action itself can clean the expired data and metadata files. So, I am wondering why this is required?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is part of earlier PR #4705. I think this PR was separated out to get consensus on the interface for this action.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this PR was separated out from #4705 to get consensus on the interface for this action.

The ExpireSnapshots action does delete the files associated with expired snapshots. However, the RemoveExpiredFiles action serves a different purpose. While ExpireSnapshots removes the expired snapshots from the top-level metadata, some files that should be deleted might still remain due to actions like table copying. Essentially, RemoveExpiredFiles allows the target table to simulate the ExpireSnapshots behavior in the source table, ensuring that the files are cleaned up appropriately.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a) Let me go through the table copying PR and the changes looks like it is specifically needed only for table copy.
b) Can't the existing remove orphan files clean those left over files after table copy?
c) RemoveExpiredFiles, I definitely want the naming to be different. It is already confusing. Maybe as RemoveTableCopyOrphanFiles

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the existing remove orphan files can clean those left over files, but it is very expensive, especially for S3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants