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
8703898d
Commit
8703898d
authored
11 years ago
by
Aaron Davidson
Browse files
Options
Downloads
Patches
Plain Diff
Address Reynold's comments
parent
3ca52309
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/storage/ShuffleBlockManager.scala
+16
-12
16 additions, 12 deletions
.../scala/org/apache/spark/storage/ShuffleBlockManager.scala
with
16 additions
and
12 deletions
core/src/main/scala/org/apache/spark/storage/ShuffleBlockManager.scala
+
16
−
12
View file @
8703898d
...
...
@@ -45,7 +45,7 @@ trait ShuffleBlocks {
}
/**
* Manages assigning disk-based block writers to shuffle tasks. Each shuffle task gets one file
and
* Manages assigning disk-based block writers to shuffle tasks. Each shuffle task gets one file
* per reducer (this set of files is called a ShuffleFileGroup).
*
* As an optimization to reduce the number of physical shuffle files produced, multiple shuffle
...
...
@@ -57,11 +57,13 @@ trait ShuffleBlocks {
* - bucketId: The id of the output partition (i.e., reducer id)
* - fileId: The unique id identifying a group of "combined shuffle files." Only one task at a
* time owns a particular fileId, and this id is returned to a pool when the task finishes.
* Each shuffle file is then mapped to a FileSegment, which is a 3-tuple (file, offset, length)
* that specifies where in a given file the actual block data is located.
*
* Shuffle file metadata is stored in a space-efficient manner. Rather than simply mapping
* ShuffleBlockIds to FileSegments, each ShuffleFile maintains a list of offsets for each
block
* stored in that file. In order to find the location of a shuffle block, we search all
ShuffleFiles
* destined for the block's reducer.
* ShuffleBlockIds
directly
to FileSegments, each ShuffleFile maintains a list of offsets for each
*
block
stored in that file. In order to find the location of a shuffle block, we search all
*
ShuffleFiles
destined for the block's reducer.
*
*/
private
[
spark
]
...
...
@@ -98,18 +100,22 @@ class ShuffleBlockManager(blockManager: BlockManager) extends Logging {
private
val
metadataCleaner
=
new
MetadataCleaner
(
MetadataCleanerType
.
SHUFFLE_BLOCK_MANAGER
,
this
.
cleanup
)
def
forShuffle
(
shuffleId
:
Int
,
numBuckets
:
Int
,
serializer
:
Serializer
)
=
{
def
forShuffle
(
shuffleId
:
Int
,
numBuckets
:
Int
,
serializer
:
Serializer
)
:
ShuffleBlocks
=
{
initializeShuffleMetadata
(
shuffleId
,
numBuckets
)
new
ShuffleBlocks
{
override
def
acquireWriters
(
mapId
:
Int
)
:
ShuffleWriterGroup
=
{
val
bufferSize
=
System
.
getProperty
(
"spark.shuffle.file.buffer.kb"
,
"100"
).
toInt
*
1024
val
fileGroup
=
getUnusedFileGroup
(
shuffleId
,
mapId
,
numBuckets
)
val
writers
=
Array
.
tabulate
[
BlockObjectWriter
](
numBuckets
)
{
bucketId
=>
val
blockId
=
ShuffleBlockId
(
shuffleId
,
mapId
,
bucketId
)
if
(
consolidateShuffleFiles
)
{
var
fileGroup
:
ShuffleFileGroup
=
null
val
writers
=
if
(
consolidateShuffleFiles
)
{
fileGroup
=
getUnusedFileGroup
(
shuffleId
,
mapId
,
numBuckets
)
Array
.
tabulate
[
BlockObjectWriter
](
numBuckets
)
{
bucketId
=>
val
blockId
=
ShuffleBlockId
(
shuffleId
,
mapId
,
bucketId
)
blockManager
.
getDiskWriter
(
blockId
,
fileGroup
(
bucketId
).
file
,
serializer
,
bufferSize
)
}
else
{
}
}
else
{
Array
.
tabulate
[
BlockObjectWriter
](
numBuckets
)
{
bucketId
=>
val
blockId
=
ShuffleBlockId
(
shuffleId
,
mapId
,
bucketId
)
val
blockFile
=
blockManager
.
diskBlockManager
.
getFile
(
blockId
)
blockManager
.
getDiskWriter
(
blockId
,
blockFile
,
serializer
,
bufferSize
)
}
...
...
@@ -142,8 +148,6 @@ class ShuffleBlockManager(blockManager: BlockManager) extends Logging {
}
private
def
getUnusedFileGroup
(
shuffleId
:
Int
,
mapId
:
Int
,
numBuckets
:
Int
)
:
ShuffleFileGroup
=
{
if
(!
consolidateShuffleFiles
)
{
return
null
}
val
pool
=
shuffleToFileGroupPoolMap
(
shuffleId
)
var
fileGroup
=
pool
.
getUnusedFileGroup
()
...
...
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