-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-5259][CORE]Make sure shuffle metadata already in mapOutPutTracker while submitting tasks of the shuffleMapStage #4055
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
Closed
Closed
Changes from 1 commit
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
641936f
Make sure mapStage.pendingtasks is set() while MapStage.isAvailable i…
suyanNone 741ab4d
Add sub-class canEqual to make ShuffleMapTask not equal Result Task w…
suyanNone 5ec8a82
Refine
suyanNone 9044720
add parameter type
suyanNone 03db624
Refine
suyanNone 8dfdc18
Refine log message use string interpolation
suyanNone c286f7a
Refine with the latest spark
suyanNone dcf1533
Refine solution and fix bug in code
suyanNone 27da8e7
Refine codeStyle
suyanNone bd5fec4
Refine Tests
suyanNone 4dbe4d3
Refine assert exception
suyanNone 9dfff63
Refine the test 'ignore late map task completions'
suyanNone e1e0b66
Refine the testcase
suyanNone 2379250
Refine scala style
suyanNone 314873a
Only tracker partitionId to instead of Task
suyanNone 7ae128e
Refine test name
suyanNone b2df3fd
refine suite code
suyanNone File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Refine the testcase
- Loading branch information
commit e1e0b66abc7430e88b8a58ec0c81a8d500bf6caa
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -748,48 +748,77 @@ class DAGSchedulerSuite | |
| val reduceRdd = new MyRDD(sc, 1, List(shuffleDep)) | ||
| submit(reduceRdd, Array(0)) | ||
|
|
||
| // things start out smoothly, stage 0 completes with no issues | ||
| complete(taskSets(0), Seq( | ||
| (Success, makeMapStatus("hostB", shuffleMapRdd.partitions.size)), | ||
| (Success, makeMapStatus("hostB", shuffleMapRdd.partitions.size)), | ||
| (Success, makeMapStatus("hostA", shuffleMapRdd.partitions.size)) | ||
| )) | ||
|
|
||
| complete(taskSets(1), Seq( | ||
| (Success, makeMapStatus("hostA", reduceRdd.partitions.size)), | ||
| (Success, makeMapStatus("hostB", reduceRdd.partitions.size)) | ||
| )) | ||
| // then one executor dies, and a task fails in stage 1 | ||
| runEvent(ExecutorLost("exec-hostA")) | ||
| // Resubmit already succcessd in hostA task | ||
| runEvent(CompletionEvent(taskSets(1).tasks(0), Resubmitted, | ||
| null, null, createFakeTaskInfo(), null)) | ||
|
|
||
| // Cause mapOutTracker remove hostA outputs for taskset(0). | ||
| // Task that resubmitted will fetch matadata failed. | ||
| runEvent(CompletionEvent(taskSets(1).tasks(0), | ||
| FetchFailed(null, firstShuffleId, 2, 0, "Fetch failed"), | ||
| null, null, createFakeTaskInfo(), null)) | ||
|
|
||
| // FetchFailed cause resubmit failed Stages. | ||
| scheduler.resubmitFailedStages() | ||
|
|
||
| runEvent(CompletionEvent(taskSets(0).tasks(2), Success, | ||
| // so we resubmit stage 0, which completes happily | ||
| Thread.sleep(1000) | ||
| val stage0Resubmit = taskSets(2) | ||
| assert(stage0Resubmit.stageId == 0) | ||
| assert(stage0Resubmit.attempt === 1) | ||
| val task = stage0Resubmit.tasks(0) | ||
| assert(task.partitionId === 2) | ||
| runEvent(CompletionEvent(task, Success, | ||
| makeMapStatus("hostC", shuffleMapRdd.partitions.size), null, createFakeTaskInfo(), null)) | ||
|
|
||
| try { | ||
| mapOutputTracker.getServerStatuses(0, 2) | ||
| } catch { | ||
| case e: MetadataFetchFailedException => fail("Should not throw metadataFetchFailedException") | ||
| } | ||
|
|
||
| runEvent(CompletionEvent(taskSets(1).tasks(0), Success, | ||
| // now here is where things get tricky : we will now have a task set representing | ||
| // the second attempt for stage 1, but we *also* have some tasks for the first attempt for | ||
| // stage 1 still going | ||
| val stage1Resubmit = taskSets(3) | ||
| assert(stage1Resubmit.stageId == 1) | ||
| assert(stage1Resubmit.attempt === 1) | ||
| assert(stage1Resubmit.tasks.length === 3) | ||
|
|
||
| // we'll have some tasks finish from the first attempt, and some finish from the second attempt, | ||
| // so that we actually have all stage outputs, though no attempt has completed all its | ||
| // tasks | ||
| runEvent(CompletionEvent(taskSets(3).tasks(0), Success, | ||
| makeMapStatus("hostC", reduceRdd.partitions.size), null, createFakeTaskInfo(), null)) | ||
| runEvent(CompletionEvent(taskSets(1).tasks(2), Success, | ||
| runEvent(CompletionEvent(taskSets(3).tasks(1), Success, | ||
| makeMapStatus("hostC", reduceRdd.partitions.size), null, createFakeTaskInfo(), null)) | ||
| // late task finish from the first attempt | ||
| runEvent(CompletionEvent(taskSets(1).tasks(2), Success, | ||
| makeMapStatus("hostB", reduceRdd.partitions.size), null, createFakeTaskInfo(), null)) | ||
|
|
||
| // What should happen now is that we submit stage 2. However, we might not see an error | ||
| // b/c of DAGScheduler's error handling (it tends to swallow errors and just log them). But | ||
| // we can check some conditions. | ||
| // Note that the really important thing here is not so much that we submit stage 2 *immediately* | ||
| // but that we don't end up with some error from these interleaved completions. It would also | ||
| // be OK (though sub-optimal) if stage 2 simply waited until the resubmission of stage 1 had | ||
| // all its tasks complete | ||
|
|
||
| // check that we have all the map output for stage 0 (it should have been there even before | ||
| // the last round of completions from stage 1, but just to double check it hasn't been messed | ||
| // up) | ||
| (0 until 3).foreach { reduceIdx => | ||
| val arr = mapOutputTracker.getServerStatuses(0, reduceIdx) | ||
| assert(arr != null) | ||
| assert(arr.nonEmpty) | ||
| } | ||
|
|
||
| // and check we have all the map output for stage 1 | ||
| (0 until 1).foreach { reduceIdx => | ||
| val arr = mapOutputTracker.getServerStatuses(1,reduceIdx) | ||
| assert(arr != null) | ||
| assert(arr.nonEmpty) | ||
|
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. same here |
||
| } | ||
|
|
||
| val stage = scheduler.stageIdToStage(taskSets(1).stageId).asInstanceOf[ShuffleMapStage] | ||
| assert(stage.attemptId === 2) | ||
| assert(stage.isAvailable) | ||
| assert(stage.pendingTasks.isEmpty) | ||
| // and check that stage 2 has been submitted | ||
| assert(taskSets.size == 5) | ||
| val stage2TaskSet = taskSets(4) | ||
| assert(stage2TaskSet.stageId == 2) | ||
| assert(stage2TaskSet.attempt == 0) | ||
| } | ||
|
|
||
| /** | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
getServerStatuseshas been removed in master -- I guess both of these should beThe new code will now throw an exception if we're missing the map output data, but I feel like its probably still good to leave those asserts in.
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.
may the below code will be more better?
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.
we don't use
try / case e: Exception => fail("")to fail tests when there is an exception -- we just let the exception fail the test directly. You get more info in the stack trace that way. So I think its better to just leave it bare.You could just put in a comment explaining what the point is:
I still slightly prefer leaving the asserts in there. Yes, they are kinda pointless with the current behavior of
getMapSizesByExecutorId-- but I'd just like to be a bit more defensive, in case that behavior changes in the future. (eg., maybe some future refactoring makes them stop throwing exceptions for some reason).Maybe to be very clear, you could include the asserts and more comments:
This is pretty minor, though, I don't feel strongly about it.