-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-6602][Core]Replace Akka Serialization with Spark Serializer #7159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
ecec410
be3edb0
433115c
9ef4af9
73251c6
cf81a58
fc0fca3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -139,6 +139,12 @@ private[spark] abstract class RpcEnv(conf: SparkConf) { | |
| * creating it manually because different [[RpcEnv]] may have different formats. | ||
| */ | ||
| def uriOf(systemName: String, address: RpcAddress, endpointName: String): String | ||
|
|
||
| /** | ||
| * [[RpcEndpointRef]] cannot be deserialized without [[RpcEnv]]. So when deserializing any object | ||
| * that contains [[RpcEndpointRef]]s, the deserialization codes should be wrapped by this method. | ||
| */ | ||
| def deserialize[T](deserializationAction: () => T): T | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add this new method to RpcEnv for RpcEndpointRef deserialization |
||
| } | ||
|
|
||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,7 +28,7 @@ import akka.actor.{ActorSystem, ExtendedActorSystem, Actor, ActorRef, Props, Add | |
| import akka.event.Logging.Error | ||
| import akka.pattern.{ask => akkaAsk} | ||
| import akka.remote.{AssociationEvent, AssociatedEvent, DisassociatedEvent, AssociationErrorEvent} | ||
| import com.google.common.util.concurrent.MoreExecutors | ||
| import akka.serialization.JavaSerializer | ||
|
|
||
| import org.apache.spark.{SparkException, Logging, SparkConf} | ||
| import org.apache.spark.rpc._ | ||
|
|
@@ -239,6 +239,12 @@ private[spark] class AkkaRpcEnv private[akka] ( | |
| } | ||
|
|
||
| override def toString: String = s"${getClass.getSimpleName}($actorSystem)" | ||
|
|
||
| override def deserialize[T](deserializationAction: () => T): T = { | ||
| JavaSerializer.currentSystem.withValue(actorSystem.asInstanceOf[ExtendedActorSystem]) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can you explain why this is necessary?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see, because now we no longer pass akka's But more generally, since we always serialize with
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. spark JavaSerializer is used to deserialize objects. However, it does not have an actor system in the current context. I need to use Akka
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. but why do we need the actor system to deserialize it? Can't we just deserialize it with
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Oh, that's because |
||
| deserializationAction() | ||
| } | ||
| } | ||
| } | ||
|
|
||
| private[spark] class AkkaRpcEnvFactory extends RpcEnvFactory { | ||
|
|
@@ -315,6 +321,12 @@ private[akka] class AkkaRpcEndpointRef( | |
|
|
||
| override def toString: String = s"${getClass.getSimpleName}($actorRef)" | ||
|
|
||
| final override def equals(that: Any): Boolean = that match { | ||
| case other: AkkaRpcEndpointRef => actorRef == other.actorRef | ||
| case _ => false | ||
| } | ||
|
|
||
| final override def hashCode(): Int = if (actorRef == null) 0 else actorRef.hashCode() | ||
| } | ||
|
|
||
| /** | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is this thing used for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
org.apache.curator.test.TestingServeris from this artifact. An embedded ZooKeeper server for testing.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be in test scope?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. Good catch. I was thinking it but forgot to add it here.