Skip to content

SPARK-10721 Log warning when file deletion fails#8843

Closed
tedyu wants to merge 18 commits intoapache:masterfrom
tedyu:master
Closed

SPARK-10721 Log warning when file deletion fails#8843
tedyu wants to merge 18 commits intoapache:masterfrom
tedyu:master

Conversation

@tedyu
Copy link
Contributor

@tedyu tedyu commented Sep 20, 2015

No description provided.

Copy link
Member

Choose a reason for hiding this comment

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

This really isn't an error ...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is the file going to be cleaned later ?

Do you have any suggestion w.r.t. what log level should be used ?

Copy link
Member

Choose a reason for hiding this comment

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

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

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.

Copy link
Member

Choose a reason for hiding this comment

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

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.

@SparkQA
Copy link

SparkQA commented Sep 20, 2015

Test build #42729 has finished for PR 8843 at commit 240aea1.

  • This patch fails PySpark unit tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
    • case class Sort(

@SparkQA
Copy link

SparkQA commented Sep 20, 2015

Test build #42733 has finished for PR 8843 at commit cd46f28.

  • This patch fails Scala style tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
    • case class Sort(

@SparkQA
Copy link

SparkQA commented Sep 20, 2015

Test build #42736 has finished for PR 8843 at commit 411a7c1.

  • This patch fails to build.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
    • case class Sort(

@SparkQA
Copy link

SparkQA commented Sep 20, 2015

Test build #42731 has finished for PR 8843 at commit 6abdb8a.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
    • case class Sort(

@SparkQA
Copy link

SparkQA commented Sep 20, 2015

Test build #42737 has finished for PR 8843 at commit e44577c.

  • This patch fails to build.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
    • case class Sort(

@SparkQA
Copy link

SparkQA commented Sep 20, 2015

Test build #42738 has finished for PR 8843 at commit 740de99.

  • This patch fails Scala style tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@tedyu tedyu changed the title Log error when spill file wasn't deleted SPARK-10721 Log warning when file deletion fails Sep 20, 2015
@SparkQA
Copy link

SparkQA commented Sep 20, 2015

Test build #42740 has finished for PR 8843 at commit a9148c0.

  • This patch fails to build.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
    • case class Sort(

@SparkQA
Copy link

SparkQA commented Sep 20, 2015

Test build #42732 has finished for PR 8843 at commit 6962408.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Sep 21, 2015

Test build #42741 has finished for PR 8843 at commit 68edb55.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@jerryshao
Copy link
Contributor

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.

@SparkQA
Copy link

SparkQA commented Sep 21, 2015

Test build #42743 has finished for PR 8843 at commit 8fface7.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@jerryshao
Copy link
Contributor

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 delete stuffs.

@tedyu
Copy link
Contributor Author

tedyu commented Sep 21, 2015

What I have done in this PR is to keep consistency with existing code.

@srowen
Can you take another look ?

@srowen
Copy link
Member

srowen commented Sep 21, 2015

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.

@tedyu
Copy link
Contributor Author

tedyu commented Sep 21, 2015

Let me know if there is more on my side that should be done.

Copy link
Member

Choose a reason for hiding this comment

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

Nit: make this static

Copy link
Member

Choose a reason for hiding this comment

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

You can use the {} placeholder syntax for slf4j loggers here, like in other Java files

@SparkQA
Copy link

SparkQA commented Sep 22, 2015

Test build #42833 has finished for PR 8843 at commit 2b4bdac.

  • This patch fails to build.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Sep 22, 2015

Test build #42834 has finished for PR 8843 at commit 84e7467.

  • This patch fails to build.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Sep 22, 2015

Test build #42835 has finished for PR 8843 at commit 47640f6.

  • This patch fails to build.
  • This patch merges cleanly.
  • This patch adds no public classes.

Copy link
Member

Choose a reason for hiding this comment

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

A few of these are now missing the s prefix for interpolation.

@SparkQA
Copy link

SparkQA commented Sep 22, 2015

Test build #42842 has finished for PR 8843 at commit dc06976.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

Copy link
Member

Choose a reason for hiding this comment

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

One more tiny thing, since I know you'll need another pass to fix the two interpolations: the canonical order is private static final ...

Copy link
Member

Choose a reason for hiding this comment

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

Still missing interpolation here.

@SparkQA
Copy link

SparkQA commented Sep 22, 2015

Test build #42853 has finished for PR 8843 at commit c059526.

  • This patch fails to build.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Sep 22, 2015

Test build #42851 has finished for PR 8843 at commit 2885c70.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Sep 22, 2015

Test build #42857 has finished for PR 8843 at commit 8561388.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@srowen
Copy link
Member

srowen commented Sep 23, 2015

Merged into master

@asfgit asfgit closed this in 27bfa9a Sep 23, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants