Skip to content
Closed
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,9 @@ class CheckpointWriter(
+ "'")

// Write checkpoint to temp file
fs.delete(tempFile, true) // just in case it exists
if (fs.exists(tempFile)) {
fs.delete(tempFile, true) // just in case it exists
}
val fos = fs.create(tempFile)
Utils.tryWithSafeFinally {
fos.write(bytes)
Expand All @@ -203,7 +205,9 @@ class CheckpointWriter(
// If the checkpoint file exists, back it up
// If the backup exists as well, just delete it, otherwise rename will fail
if (fs.exists(checkpointFile)) {
fs.delete(backupFile, true) // just in case it exists
if (fs.exists(backupFile)){
fs.delete(backupFile, true) // just in case it exists
}
if (!fs.rename(checkpointFile, backupFile)) {
logWarning("Could not rename " + checkpointFile + " to " + backupFile)
}
Expand All @@ -219,7 +223,9 @@ class CheckpointWriter(
if (allCheckpointFiles.size > 10) {
allCheckpointFiles.take(allCheckpointFiles.size - 10).foreach(file => {
logInfo("Deleting " + file)
fs.delete(file, true)
if (fs.exists(file)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I am not if this is necessary. These files that are being deleted came from a recent listing, so they are very very likely to exist.

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 agreed and I just made the change. Can you start another build and test?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually from the error message in Spark-9801, the only 2 checks I wanted to add were:
tempFile
backupFile

So I am fine to ignore the check for "file". Also for performance consideration.

fs.delete(file, true)
}
})
}

Expand Down