Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
spark
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cs525-sp18-g07
spark
Commits
14502967
Commit
14502967
authored
11 years ago
by
Reynold Xin
Browse files
Options
Downloads
Patches
Plain Diff
SPARK-781: Log the temp directory path when Spark says "Failed to create
temp directory".
parent
e6d12773
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
core/src/main/scala/spark/Utils.scala
+2
-2
2 additions, 2 deletions
core/src/main/scala/spark/Utils.scala
core/src/main/scala/spark/storage/DiskStore.scala
+17
-17
17 additions, 17 deletions
core/src/main/scala/spark/storage/DiskStore.scala
with
19 additions
and
19 deletions
core/src/main/scala/spark/Utils.scala
+
2
−
2
View file @
14502967
...
...
@@ -116,8 +116,8 @@ private object Utils extends Logging {
while
(
dir
==
null
)
{
attempts
+=
1
if
(
attempts
>
maxAttempts
)
{
throw
new
IOException
(
"Failed to create a temp directory
aft
er "
+
maxAttempts
+
" attempts!"
)
throw
new
IOException
(
"Failed to create a temp directory
und
er
(
"
+
root
+
") after "
+
maxAttempts
+
" attempts!"
)
}
try
{
dir
=
new
File
(
root
,
"spark-"
+
UUID
.
randomUUID
.
toString
)
...
...
This diff is collapsed.
Click to expand it.
core/src/main/scala/spark/storage/DiskStore.scala
+
17
−
17
View file @
14502967
...
...
@@ -82,15 +82,15 @@ private class DiskStore(blockManager: BlockManager, rootDirs: String)
override
def
size
()
:
Long
=
lastValidPosition
}
val
MAX_DIR_CREATION_ATTEMPTS
:
Int
=
10
val
subDirsPerLocalDir
=
System
.
getProperty
(
"spark.diskStore.subDirectories"
,
"64"
).
toInt
private
val
MAX_DIR_CREATION_ATTEMPTS
:
Int
=
10
private
val
subDirsPerLocalDir
=
System
.
getProperty
(
"spark.diskStore.subDirectories"
,
"64"
).
toInt
var
shuffleSender
:
ShuffleSender
=
null
private
var
shuffleSender
:
ShuffleSender
=
null
// Create one local directory for each path mentioned in spark.local.dir; then, inside this
// directory, create multiple subdirectories that we will hash files into, in order to avoid
// having really large inodes at the top level.
val
localDirs
=
createLocalDirs
()
val
subDirs
=
Array
.
fill
(
localDirs
.
length
)(
new
Array
[
File
](
subDirsPerLocalDir
))
private
val
localDirs
:
Array
[
File
]
=
createLocalDirs
()
private
val
subDirs
=
Array
.
fill
(
localDirs
.
length
)(
new
Array
[
File
](
subDirsPerLocalDir
))
addShutdownHook
()
...
...
@@ -99,7 +99,6 @@ private class DiskStore(blockManager: BlockManager, rootDirs: String)
new
DiskBlockObjectWriter
(
blockId
,
serializer
,
bufferSize
)
}
override
def
getSize
(
blockId
:
String
)
:
Long
=
{
getFile
(
blockId
).
length
()
}
...
...
@@ -232,8 +231,8 @@ private class DiskStore(blockManager: BlockManager, rootDirs: String)
private
def
createLocalDirs
()
:
Array
[
File
]
=
{
logDebug
(
"Creating local directories at root dirs '"
+
rootDirs
+
"'"
)
val
dateFormat
=
new
SimpleDateFormat
(
"yyyyMMddHHmmss"
)
rootDirs
.
split
(
","
).
map
(
rootDir
=>
{
var
foundLocalDir
:
Boolean
=
false
rootDirs
.
split
(
","
).
map
{
rootDir
=>
var
foundLocalDir
=
false
var
localDir
:
File
=
null
var
localDirId
:
String
=
null
var
tries
=
0
...
...
@@ -248,7 +247,7 @@ private class DiskStore(blockManager: BlockManager, rootDirs: String)
}
}
catch
{
case
e
:
Exception
=>
logWarning
(
"Attempt "
+
tries
+
" to create local dir failed"
,
e
)
logWarning
(
"Attempt "
+
tries
+
" to create local dir
"
+
localDir
+
"
failed"
,
e
)
}
}
if
(!
foundLocalDir
)
{
...
...
@@ -258,7 +257,7 @@ private class DiskStore(blockManager: BlockManager, rootDirs: String)
}
logInfo
(
"Created local directory at "
+
localDir
)
localDir
}
)
}
}
private
def
addShutdownHook
()
{
...
...
@@ -266,15 +265,16 @@ private class DiskStore(blockManager: BlockManager, rootDirs: String)
Runtime
.
getRuntime
.
addShutdownHook
(
new
Thread
(
"delete Spark local dirs"
)
{
override
def
run
()
{
logDebug
(
"Shutdown hook called"
)
try
{
localDirs
.
foreach
{
localDir
=>
localDirs
.
foreach
{
localDir
=>
try
{
if
(!
Utils
.
hasRootAsShutdownDeleteDir
(
localDir
))
Utils
.
deleteRecursively
(
localDir
)
}
catch
{
case
t
:
Throwable
=>
logError
(
"Exception while deleting local spark dir: "
+
localDir
,
t
)
}
if
(
shuffleSender
!=
null
)
{
shuffleSender
.
stop
}
}
catch
{
case
t
:
Throwable
=>
logError
(
"Exception while deleting local spark dirs"
,
t
)
}
if
(
shuffleSender
!=
null
)
{
shuffleSender
.
stop
}
}
})
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment