Skip to content

Commit 7fb1117

Browse files
Ngone51squito
authored andcommittedApr 19, 2018
[SPARK-24021][CORE] fix bug in BlacklistTracker's updateBlacklistForFetchFailure
## What changes were proposed in this pull request? There‘s a miswrite in BlacklistTracker's updateBlacklistForFetchFailure: ``` val blacklistedExecsOnNode = nodeToBlacklistedExecs.getOrElseUpdate(exec, HashSet[String]()) blacklistedExecsOnNode += exec ``` where first **exec** should be **host**. ## How was this patch tested? adjust existed test. Author: wuyi <ngone_5451@163.com> Closes #21104 from Ngone51/SPARK-24021. (cherry picked from commit 0deaa52) Signed-off-by: Imran Rashid <irashid@cloudera.com>
1 parent 32bec6c commit 7fb1117

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed
 

‎core/src/main/scala/org/apache/spark/scheduler/BlacklistTracker.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ private[scheduler] class BlacklistTracker (
210210
updateNextExpiryTime()
211211
killBlacklistedExecutor(exec)
212212

213-
val blacklistedExecsOnNode = nodeToBlacklistedExecs.getOrElseUpdate(exec, HashSet[String]())
213+
val blacklistedExecsOnNode = nodeToBlacklistedExecs.getOrElseUpdate(host, HashSet[String]())
214214
blacklistedExecsOnNode += exec
215215
}
216216
}

‎core/src/test/scala/org/apache/spark/scheduler/BlacklistTrackerSuite.scala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -574,6 +574,9 @@ class BlacklistTrackerSuite extends SparkFunSuite with BeforeAndAfterEach with M
574574
verify(allocationClientMock, never).killExecutors(any(), any(), any(), any())
575575
verify(allocationClientMock, never).killExecutorsOnHost(any())
576576

577+
assert(blacklist.nodeToBlacklistedExecs.contains("hostA"))
578+
assert(blacklist.nodeToBlacklistedExecs("hostA").contains("1"))
579+
577580
// Enable auto-kill. Blacklist an executor and make sure killExecutors is called.
578581
conf.set(config.BLACKLIST_KILL_ENABLED, true)
579582
blacklist = new BlacklistTracker(listenerBusMock, conf, Some(allocationClientMock), clock)
@@ -589,6 +592,8 @@ class BlacklistTrackerSuite extends SparkFunSuite with BeforeAndAfterEach with M
589592
1000 + blacklist.BLACKLIST_TIMEOUT_MILLIS)
590593
assert(blacklist.nextExpiryTime === 1000 + blacklist.BLACKLIST_TIMEOUT_MILLIS)
591594
assert(blacklist.nodeIdToBlacklistExpiryTime.isEmpty)
595+
assert(blacklist.nodeToBlacklistedExecs.contains("hostA"))
596+
assert(blacklist.nodeToBlacklistedExecs("hostA").contains("1"))
592597

593598
// Enable external shuffle service to see if all the executors on this node will be killed.
594599
conf.set(config.SHUFFLE_SERVICE_ENABLED, true)

0 commit comments

Comments
 (0)