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
7c5f70d8
Commit
7c5f70d8
authored
11 years ago
by
Reynold Xin
Browse files
Options
Downloads
Patches
Plain Diff
Call Kryo setReferences before calling user specified Kryo registrator.
parent
3efc0195
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/serializer/KryoSerializer.scala
+10
-6
10 additions, 6 deletions
...in/scala/org/apache/spark/serializer/KryoSerializer.scala
with
10 additions
and
6 deletions
core/src/main/scala/org/apache/spark/serializer/KryoSerializer.scala
+
10
−
6
View file @
7c5f70d8
...
...
@@ -30,10 +30,14 @@ import org.apache.spark.broadcast.HttpBroadcast
import
org.apache.spark.storage.
{
GetBlock
,
GotBlock
,
PutBlock
,
StorageLevel
,
TestBlockId
}
/**
* A Spark serializer that uses the [[http://code.google.com/p/kryo/wiki/V1Documentation Kryo 1.x library]].
* A Spark serializer that uses the
* [[http://code.google.com/p/kryo/wiki/V1Documentation Kryo 1.x library]].
*/
class
KryoSerializer
extends
org
.
apache
.
spark
.
serializer
.
Serializer
with
Logging
{
private
val
bufferSize
=
System
.
getProperty
(
"spark.kryoserializer.buffer.mb"
,
"2"
).
toInt
*
1024
*
1024
private
val
bufferSize
=
{
System
.
getProperty
(
"spark.kryoserializer.buffer.mb"
,
"2"
).
toInt
*
1024
*
1024
}
def
newKryoOutput
()
=
new
KryoOutput
(
bufferSize
)
...
...
@@ -42,6 +46,10 @@ class KryoSerializer extends org.apache.spark.serializer.Serializer with Logging
val
kryo
=
instantiator
.
newKryo
()
val
classLoader
=
Thread
.
currentThread
.
getContextClassLoader
// Allow disabling Kryo reference tracking if user knows their object graphs don't have loops.
// Do this before we invoke the user registrator so the user registrator can override this.
kryo
.
setReferences
(
System
.
getProperty
(
"spark.kryo.referenceTracking"
,
"true"
).
toBoolean
)
val
blockId
=
TestBlockId
(
"1"
)
// Register some commonly used classes
val
toRegister
:
Seq
[
AnyRef
]
=
Seq
(
...
...
@@ -78,10 +86,6 @@ class KryoSerializer extends org.apache.spark.serializer.Serializer with Logging
new
AllScalaRegistrar
().
apply
(
kryo
)
kryo
.
setClassLoader
(
classLoader
)
// Allow disabling Kryo reference tracking if user knows their object graphs don't have loops
kryo
.
setReferences
(
System
.
getProperty
(
"spark.kryo.referenceTracking"
,
"true"
).
toBoolean
)
kryo
}
...
...
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