SPARK-10721 Log warning when file deletion fails#8843
SPARK-10721 Log warning when file deletion fails#8843tedyu wants to merge 18 commits intoapache:masterfrom tedyu:master
Conversation
There was a problem hiding this comment.
Is the file going to be cleaned later ?
Do you have any suggestion w.r.t. what log level should be used ?
There was a problem hiding this comment.
Error to me means something unrecoverable; the process can't continue. This is a warning maybe. It's maybe better to look across the code at places where File.delete() may fail silently and do something similar. And then open a JIRA for this small cross cutting change.
There was a problem hiding this comment.
I did some search prior to making the change:
$ find . -name '*.java' -exec grep 'file.delete(' {} ; -print
if (spill.file.exists() && !spill.file.delete()) {
./core/src/main/java/org/apache/spark/shuffle/unsafe/UnsafeShuffleExternalSorter.java
if (spill.file.exists() && ! spill.file.delete()) {
./core/src/main/java/org/apache/spark/shuffle/unsafe/UnsafeShuffleWriter.java
if (!file.delete()) {
./core/src/main/java/org/apache/spark/util/collection/unsafe/sort/UnsafeExternalSorter.java
if (!file.delete()) {
./core/src/main/java/org/apache/spark/util/collection/unsafe/sort/UnsafeSorterSpillReader.java
boolean deleted = file.delete();
./network/common/src/main/java/org/apache/spark/network/util/JavaUtils.java
This file was the only one among the files where delete() is called but whose return value wasn't checked.
There was a problem hiding this comment.
That grep assumes the File reference name ends in "file". I see 20-30 non-test usages of the method. It may not be worth logging a warning for every possible failure, but worth surveying the usages to see if any really ought to log something in case it doesn't delete.
|
Test build #42729 has finished for PR 8843 at commit
|
|
Test build #42733 has finished for PR 8843 at commit
|
|
Test build #42736 has finished for PR 8843 at commit
|
|
Test build #42731 has finished for PR 8843 at commit
|
|
Test build #42737 has finished for PR 8843 at commit
|
|
Test build #42738 has finished for PR 8843 at commit
|
|
Test build #42740 has finished for PR 8843 at commit
|
|
Test build #42732 has finished for PR 8843 at commit
|
|
Test build #42741 has finished for PR 8843 at commit
|
|
I think for most the places, Spark application shutdown hook will finally delete all temp files when application is exited, so temporary not deleted files will finally be cleaned. Besides, if this file is failed to deleted due to FS problem, it is better to throw out an exception to notify user. |
|
Test build #42743 has finished for PR 8843 at commit
|
|
Checked again in some places like here, Spark also checked whether the file is successfully deleted and print an error log if not, though this file will finally be deleted when app is exited. So I'm wondering we need to have a consistent way to handle all this |
|
What I have done in this PR is to keep consistency with existing code. @srowen |
|
Yeah this looks good. These are cases where you might actually want to know if the file deletion fails. We'll have to see whether some of these turn out to be very noisy, but if so, we'd have to ask why the deletion is failing regularly and try to fix that. That is, I think these warnings would only trigger rarely and are therefore of some value. |
|
Let me know if there is more on my side that should be done. |
There was a problem hiding this comment.
You can use the {} placeholder syntax for slf4j loggers here, like in other Java files
|
Test build #42833 has finished for PR 8843 at commit
|
|
Test build #42834 has finished for PR 8843 at commit
|
|
Test build #42835 has finished for PR 8843 at commit
|
There was a problem hiding this comment.
A few of these are now missing the s prefix for interpolation.
|
Test build #42842 has finished for PR 8843 at commit
|
There was a problem hiding this comment.
One more tiny thing, since I know you'll need another pass to fix the two interpolations: the canonical order is private static final ...
There was a problem hiding this comment.
Still missing interpolation here.
|
Test build #42853 has finished for PR 8843 at commit
|
|
Test build #42851 has finished for PR 8843 at commit
|
|
Test build #42857 has finished for PR 8843 at commit
|
|
Merged into master |
No description provided.