Github user srowen commented on a diff in the pull request:
https://github.com/apache/spark/pull/7714#discussion_r35732778
--- Diff: core/src/main/scala/org/apache/spark/deploy/worker/Worker.scala
---
@@ -614,6 +585,74 @@ private[worker] class Worker(
webUi.stop()
metricsSystem.stop()
}
+
+ private def trimFinishedExecutorsIfNecessary(): Unit = {
+ if (finishedExecutors.size > retainedExecutors) {
+ finishedExecutors.take(math.max(finishedExecutors.size / 10,
1)).foreach {
--- End diff --
The logic looks correct. I suppose you can take from the `keys()` rather
than take pairs and match on them, but this is fine.
Is this going to cause a `ConcurrentModificationException` though? you
generally can't do this in Java and this is a JDK class. Does it work because
take definitely makes a copy? Tests will tell us.
Is there in general a thread-safety problem here? I don't think the code
tries to protect this data structure to begin with, so maybe it's not actually
a problem.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]