-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-29551][CORE] Fix a bug about fetch failed when an executor is lost #26206
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 all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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
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
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 |
|---|---|---|
|
|
@@ -537,6 +537,167 @@ class DAGSchedulerSuite extends SparkFunSuite with LocalSparkContext with TimeLi | |
| assert(mapStatus2(2).location.host === "hostB") | ||
| } | ||
|
|
||
| test("[SPARK-29551] All shuffle files on the executor should be cleaned up when " + | ||
| "executor lost and then causes 'fetch failed'") { | ||
| // whether to kill Executor or not before FetchFailed | ||
| Seq(true, false).foreach { killExecutor => | ||
| afterEach() | ||
| val conf = new SparkConf() | ||
| conf.set(config.SHUFFLE_SERVICE_ENABLED.key, "true") | ||
| conf.set(config.UNREGISTER_OUTPUT_ON_HOST_ON_FETCH_FAILURE.key, "false") | ||
| init(conf) | ||
| runEvent(ExecutorAdded("exec-hostA1", "hostA")) | ||
| runEvent(ExecutorAdded("exec-hostA2", "hostA")) | ||
| runEvent(ExecutorAdded("exec-hostB", "hostB")) | ||
| val firstRDD = new MyRDD(sc, 3, Nil) | ||
| val firstShuffleDep = new ShuffleDependency(firstRDD, new HashPartitioner(3)) | ||
| val firstShuffleId = firstShuffleDep.shuffleId | ||
| val shuffleMapRdd = new MyRDD(sc, 3, List(firstShuffleDep)) | ||
| val shuffleDep = new ShuffleDependency(shuffleMapRdd, new HashPartitioner(3)) | ||
| val secondShuffleId = shuffleDep.shuffleId | ||
| val reduceRdd = new MyRDD(sc, 1, List(shuffleDep)) | ||
|
|
||
| submit(reduceRdd, Array(0)) | ||
| // map stage1 completes successfully, with one task on each executor | ||
| complete(taskSets(0), Seq( | ||
| (Success, | ||
| MapStatus(BlockManagerId("exec-hostA1", "hostA", 12345), | ||
| Array.fill[Long](1)(2), mapTaskId = 5)), | ||
| (Success, | ||
| MapStatus(BlockManagerId("exec-hostA2", "hostA", 12345), | ||
| Array.fill[Long](1)(2), mapTaskId = 6)), | ||
| (Success, makeMapStatus("hostB", 1, mapTaskId = 7)) | ||
| )) | ||
| // map stage2 completes successfully, with one task on each executor | ||
| complete(taskSets(1), Seq( | ||
| (Success, | ||
| MapStatus(BlockManagerId("exec-hostA1", "hostA", 12345), | ||
| Array.fill[Long](1)(2), mapTaskId = 8)), | ||
| (Success, | ||
| MapStatus(BlockManagerId("exec-hostA2", "hostA", 12345), | ||
| Array.fill[Long](1)(2), mapTaskId = 9)), | ||
| (Success, makeMapStatus("hostB", 1)) | ||
| )) | ||
| // make sure our test setup is correct | ||
| val initialMapStatus1 = mapOutputTracker.shuffleStatuses(firstShuffleId).mapStatuses | ||
| // val initialMapStatus1 = mapOutputTracker.mapStatuses.get(0).get | ||
|
Member
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. Shall we remove this commented code?
Contributor
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. done. |
||
| assert(initialMapStatus1.count(_ != null) === 3) | ||
| assert(initialMapStatus1.map { | ||
| _.location.executorId | ||
| }.toSet === | ||
| Set("exec-hostA1", "exec-hostA2", "exec-hostB")) | ||
| val initialMapStatus2 = mapOutputTracker.shuffleStatuses(secondShuffleId).mapStatuses | ||
| assert(initialMapStatus2.count(_ != null) === 3) | ||
| assert(initialMapStatus2.map { | ||
| _.location.executorId | ||
| }.toSet === | ||
| Set("exec-hostA1", "exec-hostA2", "exec-hostB")) | ||
| // kill exec-hostA2 | ||
| if (killExecutor) { | ||
| runEvent(ExecutorLost("exec-hostA2", ExecutorKilled)) | ||
| } | ||
| // reduce stage fails with a fetch failure from one host | ||
| complete(taskSets(2), Seq( | ||
| (FetchFailed(BlockManagerId("exec-hostA2", "hostA", 12345), | ||
| secondShuffleId, 0L, 0, 0, "ignored"), null) | ||
| )) | ||
| // Here is the main assertion -- make sure that we de-register | ||
| // the map outputs for exec-hostA2 | ||
| val mapStatus1 = mapOutputTracker.shuffleStatuses(firstShuffleId).mapStatuses | ||
| assert(mapStatus1.count(_ != null) === 2) | ||
| assert(mapStatus1(0).location.executorId === "exec-hostA1") | ||
| assert(mapStatus1(0).location.host === "hostA") | ||
| assert(mapStatus1(2).location.executorId === "exec-hostB") | ||
| assert(mapStatus1(2).location.host === "hostB") | ||
|
|
||
| val mapStatus2 = mapOutputTracker.shuffleStatuses(secondShuffleId).mapStatuses | ||
| assert(mapStatus2.count(_ != null) === 2) | ||
| assert(mapStatus2(0).location.executorId === "exec-hostA1") | ||
| assert(mapStatus2(0).location.host === "hostA") | ||
| assert(mapStatus2(2).location.executorId === "exec-hostB") | ||
| assert(mapStatus2(2).location.host === "hostB") | ||
| } | ||
| } | ||
|
|
||
| test("[SPARK-29551] All shuffle files on the host should be cleaned up when host lost") { | ||
| // whether to kill Executor or not before FetchFailed | ||
| Seq(true, false).foreach { killExecutor => | ||
| afterEach() | ||
| val conf = new SparkConf() | ||
| conf.set(config.SHUFFLE_SERVICE_ENABLED.key, "true") | ||
| conf.set(config.UNREGISTER_OUTPUT_ON_HOST_ON_FETCH_FAILURE.key, "true") | ||
| init(conf) | ||
| runEvent(ExecutorAdded("exec-hostA1", "hostA")) | ||
| runEvent(ExecutorAdded("exec-hostA2", "hostA")) | ||
| runEvent(ExecutorAdded("exec-hostB", "hostB")) | ||
| val firstRDD = new MyRDD(sc, 3, Nil) | ||
| val firstShuffleDep = new ShuffleDependency(firstRDD, new HashPartitioner(3)) | ||
| val firstShuffleId = firstShuffleDep.shuffleId | ||
| val shuffleMapRdd = new MyRDD(sc, 3, List(firstShuffleDep)) | ||
| val shuffleDep = new ShuffleDependency(shuffleMapRdd, new HashPartitioner(3)) | ||
| val secondShuffleId = shuffleDep.shuffleId | ||
| val reduceRdd = new MyRDD(sc, 1, List(shuffleDep)) | ||
|
|
||
| submit(reduceRdd, Array(0)) | ||
| // map stage1 completes successfully, with one task on each executor | ||
| complete(taskSets(0), Seq( | ||
| (Success, | ||
| MapStatus(BlockManagerId("exec-hostA1", "hostA", 12345), | ||
| Array.fill[Long](1)(2), mapTaskId = 5)), | ||
| (Success, | ||
| MapStatus(BlockManagerId("exec-hostA2", "hostA", 12345), | ||
| Array.fill[Long](1)(2), mapTaskId = 6)), | ||
| (Success, makeMapStatus("hostB", 1, mapTaskId = 7)) | ||
| )) | ||
| // map stage2 completes successfully, with one task on each executor | ||
| complete(taskSets(1), Seq( | ||
| (Success, | ||
| MapStatus(BlockManagerId("exec-hostA1", "hostA", 12345), | ||
| Array.fill[Long](1)(2), mapTaskId = 8)), | ||
| (Success, | ||
| MapStatus(BlockManagerId("exec-hostA2", "hostA", 12345), | ||
| Array.fill[Long](1)(2), mapTaskId = 9)), | ||
| (Success, makeMapStatus("hostB", 1)) | ||
| )) | ||
| // make sure our test setup is correct | ||
| val initialMapStatus1 = mapOutputTracker.shuffleStatuses(firstShuffleId).mapStatuses | ||
| assert(initialMapStatus1.count(_ != null) === 3) | ||
| assert(initialMapStatus1.map { | ||
| _.location.executorId | ||
| }.toSet === | ||
| Set("exec-hostA1", "exec-hostA2", "exec-hostB")) | ||
|
|
||
| val initialMapStatus2 = mapOutputTracker.shuffleStatuses(secondShuffleId).mapStatuses | ||
| assert(initialMapStatus2.count(_ != null) === 3) | ||
| assert(initialMapStatus2.map { | ||
| _.location.executorId | ||
| }.toSet === | ||
| Set("exec-hostA1", "exec-hostA2", "exec-hostB")) | ||
| // kill exec-hostA2 | ||
| if (killExecutor) { | ||
| runEvent(ExecutorLost("exec-hostA2", ExecutorKilled)) | ||
| } | ||
| // reduce stage fails with a fetch failure from one host | ||
| complete(taskSets(2), Seq( | ||
| (FetchFailed(BlockManagerId("exec-hostA2", "hostA", 12345), | ||
| secondShuffleId, 0L, 0, 0, "ignored"), | ||
| null) | ||
| )) | ||
|
|
||
| // Here is the main assertion -- make sure that we de-register | ||
| // the map outputs for both map stage from both executors on hostA | ||
| val mapStatus1 = mapOutputTracker.shuffleStatuses(firstShuffleId).mapStatuses | ||
| assert(mapStatus1.count(_ != null) === 1) | ||
| assert(mapStatus1(2).location.executorId === "exec-hostB") | ||
| assert(mapStatus1(2).location.host === "hostB") | ||
|
|
||
| val mapStatus2 = mapOutputTracker.shuffleStatuses(secondShuffleId).mapStatuses | ||
| assert(mapStatus2.count(_ != null) === 1) | ||
| assert(mapStatus2(2).location.executorId === "exec-hostB") | ||
| assert(mapStatus2(2).location.host === "hostB") | ||
| } | ||
| } | ||
|
|
||
| test("zero split job") { | ||
| var numResults = 0 | ||
| var failureReason: Option[Exception] = None | ||
|
|
||
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.
There will be a regressionis misleading because this mean this PR causes a regression.