Uh oh!
There was an error while loading. Please reload this page.
[SPARK-24817][Core] Implement BarrierTaskContext.barrier() - #21898
[SPARK-24817][Core] Implement BarrierTaskContext.barrier()#21898jiangxb1987 wants to merge 19 commits into
Conversation
SparkQA
commented
Jul 27, 2018
Test build #93685 has finished for PR 21898 at commit
|
de517f5 to
5c5db85CompareSparkQA
commented
Jul 28, 2018
Test build #93706 has finished for PR 21898 at commit
|
kiszk
commented
Jul 28, 2018
retest this please |
SparkQA
commented
Jul 28, 2018
Test build #93730 has finished for PR 21898 at commit
|
There was a problem hiding this comment.
I think here should not be another context.barrier()?
There was a problem hiding this comment.
This is to demonstrate that in one task there is only one call of barrier() while in others there may be two calls of barrier(). Please refer to BarrierTaskContextSuite."throw exception if barrier() call mismatched". However, I'm still considering what shall be the most proper behavior for this scenario.
There was a problem hiding this comment.
I set a fix timeout for RPC intentionally, so users shall get a SparkException thrown by BarrierCoordinator, instead of RPCTimeoutException from the RPC framework.
There was a problem hiding this comment.
You should add an inline comment so readers understand why.
There was a problem hiding this comment.
Shall we stop timer for this epoch here if the global sync finished successfully?
There was a problem hiding this comment.
Nice catch! just updated.
SparkQA
commented
Jul 29, 2018
Test build #93738 has finished for PR 21898 at commit
|
SparkQA
commented
Jul 29, 2018
Test build #93737 has finished for PR 21898 at commit
|
jiangxb1987
commented
Jul 29, 2018
retest this please |
SparkQA
commented
Jul 29, 2018
Test build #93742 has finished for PR 21898 at commit
|
SparkQA
commented
Jul 29, 2018
Test build #93743 has finished for PR 21898 at commit
|
jiangxb1987
commented
Jul 29, 2018
retest this please |
SparkQA
commented
Jul 29, 2018
Test build #93748 has finished for PR 21898 at commit
|
766381d to
cb1861dComparegatorsmile
commented
Jul 30, 2018
SparkQA
commented
Jul 30, 2018
Test build #93785 has finished for PR 21898 at commit
|
There was a problem hiding this comment.
is it better to use HashMap[(Int, Int), Int]?
There was a problem hiding this comment.
Also, how about using AtomicLong to remember the epoch?
There was a problem hiding this comment.
will users set this config in milliseconds? I feel seconds should be more common.
There was a problem hiding this comment.
I'm also confused here. Is it part of this PR? We should kill all task attempts in case of any task failures in a barrier stage, not limited to context.barrier() failures. Right?
There was a problem hiding this comment.
IIRC killing all tasks is just the best effort, we can guarantee the tasks are all killed. Shall we tolerate this in the barrier scheduling?
mengxr
left a comment
There was a problem hiding this comment.
One high-level comment is to move fail all task attempts to a separate PR to make this one minimal.
There was a problem hiding this comment.
Epoch counter for each barrier (stage, attempt).- Remove "fail ..." because it is not implemented by this variable.
There was a problem hiding this comment.
Then shall we switch to Java's ConcurrentHashMap?
There was a problem hiding this comment.
Ditto (stage, attempt) -> contexts.
There was a problem hiding this comment.
I'm also confused here. Is it part of this PR? We should kill all task attempts in case of any task failures in a barrier stage, not limited to context.barrier() failures. Right?
There was a problem hiding this comment.
should comment why we need local cluster
There was a problem hiding this comment.
5ms seem too risky to me. Actually, 1 second is perhaps okay here.
There was a problem hiding this comment.
Why ignored? To create this scenario, we might need to create a new thread to call context.barrier() and then interrupt the thread.
SparkQA
commented
Aug 1, 2018
Test build #93890 has finished for PR 21898 at commit
|
gatorsmile
commented
Aug 1, 2018
retest this please |
SparkQA
commented
Aug 2, 2018
Test build #93911 has finished for PR 21898 at commit
|
There was a problem hiding this comment.
is this needed? when we call syncRequestsByStageIdAndAttempt.remove((stageId, stageAttemptId)), the array buffer becomes dangling and will be GCed.
There was a problem hiding this comment.
This is just to be safe, in case the requests are held in other places, we can still GC the RpcCallContexts
There was a problem hiding this comment.
Agree with @cloud-fan that this is not necessary. It only explicitly clears the ArrayBuffer object instead of the contexts.
There was a problem hiding this comment.
when will we use the default value 0?
There was a problem hiding this comment.
nit:
if (...) {
...
true
} else {
false
}
There was a problem hiding this comment.
what if all the sync requests finish before timeout? then here we may init the request array again.
There was a problem hiding this comment.
we should have some tests for the timeout behavior, by setting a very small timeout.
There was a problem hiding this comment.
Em, how about cancel the TimerTask when sync request finished successfully?
There was a problem hiding this comment.
yea we should do that, but we also need to consider race like sync request finishes and timer triggers at the same time.
There was a problem hiding this comment.
We will also remove the internal data on stage completed, so I assume the race condition you mentioned won't cause serious issues, the internal data will after all be removed.
There was a problem hiding this comment.
although very unlikely, shall we add an assert that syncRequests.length == numTasks? Just in case we have a bug and some barrier tasks have a different value of numTasks.
There was a problem hiding this comment.
We don't remember the numTasks in BarrierCoordinator, if it really worth that then we have to use another map to store the information.
There was a problem hiding this comment.
each barrier task remembers numTask, so here we can make sure barrier tasks of same group would have same numTasks
jiangxb1987
commented
Aug 6, 2018
They are not - I made the variable |
kiszk
commented
Aug 6, 2018
I see. got it, thanks |
| // Number of tasks of the current barrier stage, a barrier() call must collect enough requests | ||
| // from different tasks within the same barrier stage attempt to succeed. | ||
| private lazy val numTasks = getTaskInfos().size |
There was a problem hiding this comment.
If change it to a def then we have to call getTaskInfos() every time, the current lazy val shall only call getTaskInfos() once.
| Utils.tryLogNonFatalError { | ||
| _executorAllocationManager.foreach(_.stop()) | ||
| } | ||
| if (_dagScheduler != null) { |
There was a problem hiding this comment.
This is to fix #21898 (comment) , previously LiveListenerBus was stopped before we stop DAGScheduler.
| val callSite = Utils.getCallSite() | ||
| logInfo(s"Task $taskAttemptId from Stage $stageId(Attempt $stageAttemptNumber) has entered " + | ||
| s"the global sync, current barrier epoch is $barrierEpoch.") | ||
| logTrace(s"Current callSite: $callSite") |
There was a problem hiding this comment.
or simpler: logTrace("Current callSite: " + Utils.getCallSite())
| listenerBus: LiveListenerBus, | ||
| override val rpcEnv: RpcEnv) extends ThreadSafeRpcEndpoint with Logging { | ||
| private lazy val timer = new Timer("BarrierCoordinator barrier epoch increment timer") |
There was a problem hiding this comment.
Will we identify the underlying reason before merging to master?
There was a problem hiding this comment.
This is certainly a potential bug in SparkSubmit and not related to the changes made in this PR, I don't feel it shall block this PR.
There was a problem hiding this comment.
I opened https://issues.apache.org/jira/browse/SPARK-25030 to track the issue.
gatorsmile
commented
Aug 6, 2018
ok to test |
cloud-fan
commented
Aug 6, 2018
retest this please |
cloud-fan
commented
Aug 6, 2018
LGTM, pending jenkins |
SparkQA
commented
Aug 6, 2018
Test build #94279 has finished for PR 21898 at commit
|
SparkQA
commented
Aug 6, 2018
Test build #94286 has finished for PR 21898 at commit
|
SparkQA
commented
Aug 6, 2018
Test build #94277 has finished for PR 21898 at commit
|
SparkQA
commented
Aug 6, 2018
Test build #94275 has finished for PR 21898 at commit
|
mengxr
commented
Aug 6, 2018
test this please |
1 similar comment
mengxr
commented
Aug 7, 2018
test this please |
SparkQA
commented
Aug 7, 2018
Test build #94318 has finished for PR 21898 at commit
|
cloud-fan
commented
Aug 7, 2018
retest this please |
cloud-fan
commented
Aug 7, 2018
is there a way to increase the build timeout? cc @shaneknapp |
SparkQA
commented
Aug 7, 2018
Test build #94326 has finished for PR 21898 at commit
|
cloud-fan
commented
Aug 7, 2018
retest this please |
mengxr
commented
Aug 7, 2018
test this please |
HyukjinKwon
commented
Aug 7, 2018
@rxin, here we seems indeed starting to hit the time limit now. |
SparkQA
commented
Aug 7, 2018
Test build #94333 has finished for PR 21898 at commit
|
cloud-fan
commented
Aug 7, 2018
great, finally tests pass! thanks, merging to master! |
SparkQA
commented
Aug 7, 2018
Test build #94344 has finished for PR 21898 at commit
|
SparkQA
commented
Aug 7, 2018
Test build #94341 has finished for PR 21898 at commit
|
What changes were proposed in this pull request?
Implement BarrierTaskContext.barrier(), to support global sync between all the tasks in a barrier stage.
The function set a global barrier and waits until all tasks in this stage hit this barrier. Similar to MPI_Barrier function in MPI, the barrier() function call blocks until all tasks in the same stage have reached this routine. The global sync shall finish immediately once all tasks in the same barrier stage reaches the same barrier.
This PR implements BarrierTaskContext.barrier() based on netty-based RPC client, introduces new
BarrierCoordinatorand newBarrierCoordinatorMessage, and new config to handle timeout issue.How was this patch tested?
Add
BarrierTaskContextSuiteto testBarrierTaskContext.barrier()