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
8b377718
Commit
8b377718
authored
11 years ago
by
Patrick Wendell
Browse files
Options
Downloads
Patches
Plain Diff
Responses to review
parent
391133f6
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
core/src/main/scala/org/apache/spark/CacheManager.scala
+4
-4
4 additions, 4 deletions
core/src/main/scala/org/apache/spark/CacheManager.scala
with
4 additions
and
4 deletions
core/src/main/scala/org/apache/spark/CacheManager.scala
+
4
−
4
View file @
8b377718
...
@@ -34,7 +34,7 @@ private[spark] class CacheManager(blockManager: BlockManager) extends Logging {
...
@@ -34,7 +34,7 @@ private[spark] class CacheManager(blockManager: BlockManager) extends Logging {
def
getOrCompute
[
T
](
rdd
:
RDD
[
T
],
split
:
Partition
,
context
:
TaskContext
,
storageLevel
:
StorageLevel
)
def
getOrCompute
[
T
](
rdd
:
RDD
[
T
],
split
:
Partition
,
context
:
TaskContext
,
storageLevel
:
StorageLevel
)
:
Iterator
[
T
]
=
{
:
Iterator
[
T
]
=
{
val
key
=
"rdd_%d_%d"
.
format
(
rdd
.
id
,
split
.
index
)
val
key
=
"rdd_%d_%d"
.
format
(
rdd
.
id
,
split
.
index
)
log
Info
(
"Looking for partition "
+
key
)
log
Debug
(
"Looking for partition "
+
key
)
blockManager
.
get
(
key
)
match
{
blockManager
.
get
(
key
)
match
{
case
Some
(
values
)
=>
case
Some
(
values
)
=>
// Partition is already materialized, so just return its values
// Partition is already materialized, so just return its values
...
@@ -44,11 +44,11 @@ private[spark] class CacheManager(blockManager: BlockManager) extends Logging {
...
@@ -44,11 +44,11 @@ private[spark] class CacheManager(blockManager: BlockManager) extends Logging {
// Mark the split as loading (unless someone else marks it first)
// Mark the split as loading (unless someone else marks it first)
loading
.
synchronized
{
loading
.
synchronized
{
if
(
loading
.
contains
(
key
))
{
if
(
loading
.
contains
(
key
))
{
logInfo
(
"
Loading contains "
+
key
+
", waiting..."
)
logInfo
(
"
Another thread is loading %s, waiting for it to finish..."
.
format
(
key
)
)
while
(
loading
.
contains
(
key
))
{
while
(
loading
.
contains
(
key
))
{
try
{
loading
.
wait
()}
catch
{
case
_
:
Throwable
=>}
try
{
loading
.
wait
()}
catch
{
case
_
:
Throwable
=>}
}
}
logInfo
(
"
Loading no longer contains "
+
key
+
", so returning cached result"
)
logInfo
(
"
Finished waiting for %s"
.
format
(
key
)
)
// See whether someone else has successfully loaded it. The main way this would fail
// See whether someone else has successfully loaded it. The main way this would fail
// is for the RDD-level cache eviction policy if someone else has loaded the same RDD
// is for the RDD-level cache eviction policy if someone else has loaded the same RDD
// partition but we didn't want to make space for it. However, that case is unlikely
// partition but we didn't want to make space for it. However, that case is unlikely
...
@@ -58,7 +58,7 @@ private[spark] class CacheManager(blockManager: BlockManager) extends Logging {
...
@@ -58,7 +58,7 @@ private[spark] class CacheManager(blockManager: BlockManager) extends Logging {
case
Some
(
values
)
=>
case
Some
(
values
)
=>
return
values
.
asInstanceOf
[
Iterator
[
T
]]
return
values
.
asInstanceOf
[
Iterator
[
T
]]
case
None
=>
case
None
=>
logInfo
(
"Whoever was loading
"
+
key
+
"
failed; we'll try it ourselves"
)
logInfo
(
"Whoever was loading
%s
failed; we'll try it ourselves"
.
format
(
key
)
)
loading
.
add
(
key
)
loading
.
add
(
key
)
}
}
}
else
{
}
else
{
...
...
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