-
Notifications
You must be signed in to change notification settings - Fork 28.9k
[SPARK-37894][SQL] Add trash feature to FileCommitProtocol.deleteWithJob #35188
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -175,10 +175,19 @@ abstract class FileCommitProtocol extends Logging { | |
|
|
||
| /** | ||
| * Specifies that a file should be deleted with the commit of this job. The default | ||
| * implementation deletes the file immediately. | ||
| * implementation deletes the file immediately or moves file to trash based on whether | ||
| * the trash feature is enabled. | ||
| * | ||
| * See https://hadoop.apache.org/docs/stable/hadoop-project-dist/hadoop-common/core-default.xml | ||
| * for the relevant trash configuration | ||
| */ | ||
| def deleteWithJob(fs: FileSystem, path: Path, recursive: Boolean): Boolean = { | ||
| fs.delete(path, recursive) | ||
| if (fs.getConf.getInt("fs.trash.interval", 0) > 0 && | ||
| Trash.moveToAppropriateTrash(fs, path, fs.getConf)) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. will this function call fail? if it will then it's better to try-catch it, log the error and fallback to non-trash behavior.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This reminds me of #29552. I think at least the concerns raised there should be addressed here.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, the trash feature was merged and reverted historically from Apache Spark repository.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Trash is a feature of Hadoop file system, and we need to think about how to integrate it with Spark. This may not be the only place to consider the trash feature. |
||
| true | ||
| } else { | ||
| fs.delete(path, recursive); | ||
| } | ||
| } | ||
|
|
||
| /** | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where can I find the document of
fs.trash.interval? It's better to add a comment to link to the hadoop conf doc page, to explain that this conf indicates enabling the trash feature.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had added a comment to link hadoop conf doc page. Thanks.