-
Notifications
You must be signed in to change notification settings - Fork 28k
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
[SPARK-5174][SPARK-5175] provide more APIs in ActorHelper #3984
Conversation
Hi, @tdas, do you mind reviewing this? |
Test build #25342 has finished for PR 3984 at commit
|
|
||
val n: AtomicInteger = new AtomicInteger(0) | ||
val hiccups: AtomicInteger = new AtomicInteger(0) | ||
|
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.
Why do you stop using AtomicInteger?
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.
supervisor is single-threaded , I don't think we have scenario where we update concurrently
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.
I think, it's not single-threaded. Multiple threads can access to Supervisor. Each thread couldn't access at a same time but it includes memory-visibility problem.
Or, how about marking those vals as volatile?
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.
hmmm......because supervisor is implemented as an actor, n and hiccups are maintained as the state of the actor and are only accessed via the handler of the message... so...I don't think it can be accessed by multiple threads ...I missed something in the code?
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.
You try to log the current thread name in receive
and then, you can see multiple threads access receive
.
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.
I see what you mean....yes, you're correct, since the running thread of the actor can be changed before the updated value is written back to the memory....
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.
Hi, @sarutak , I went back to Akka's document http://doc.akka.io/docs/akka/snapshot/general/jmm.html (Actors and the Java Memory Model), I think they stated that,
"internal fields of the actor are visible when the next message is processed by that actor. So fields in your actor need not be volatile or equivalent. "
So, we don't need to explicitly mark these variables to be volatile?
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.
Correct, volatile is not necessary. https://groups.google.com/forum/#!msg/scalaz/kFnICLFjO-4/GT_59mZLrFAJ
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.
I see, Akka's actor makes sure the visibility.
anyone can take a review of this? |
ping |
1 similar comment
ping |
ping? @tdas do you mind taking a review? |
Will do as soon as I finish some stuff regarding the Spark 1.3 release. :) On Sun, Feb 22, 2015 at 7:55 AM, Nan Zhu notifications@github.com wrote:
|
sure, thanks |
@tdas @CodingCat what's the status on this one? looks like it needs a rebase now |
I will do it next week....as there is a significant change in the code base (Akka was gone), I will think about how to adapt it to the current master branch |
Test build #33006 has finished for PR 3984 at commit
|
It's easier than I thought, the changes about RPC interface didn't touch this part @tdas might have a review? |
Sorry about the delay. Will take a look once the 1.4 release craze is over. On Mon, May 18, 2015 at 2:20 PM, Nan Zhu notifications@github.com wrote:
|
Test build #38072 has finished for PR 3984 at commit
|
Test build #38073 has finished for PR 3984 at commit
|
Test build #1169 has finished for PR 3984 at commit
|
Test build #38138 has finished for PR 3984 at commit
|
Test build #38140 has finished for PR 3984 at commit
|
Hi, @tdas , do you have time to review it? |
@CodingCat could you close this one? We can revisit this one when moving Actor to a separate project. Thanks! |
sure |
https://issues.apache.org/jira/browse/SPARK-5174
https://issues.apache.org/jira/browse/SPARK-5175