Github user squito commented on a diff in the pull request: https://github.com/apache/spark/pull/6263#discussion_r44063735 --- Diff: core/src/test/scala/org/apache/spark/storage/StorageStatusListenerSuite.scala --- @@ -150,4 +157,21 @@ class StorageStatusListenerSuite extends FunSuite { listener.onUnpersistRDD(SparkListenerUnpersistRDD(1)) assert(listener.executorIdToStorageStatus("big").numBlocks === 0) } + + test("Killed Executor Entry removed after configurable time") { + val localtestconf = new SparkConf().set(StorageStatusListener.TIME_TO_EXPIRE_KILLED_EXECUTOR,"5s") + val ticker = new Ticker { + val nanos = new AtomicLong() + def advance(time: Long, timeUnit: TimeUnit) = { + nanos.addAndGet(timeUnit.toNanos(time)) + } + override def read() = { + nanos.getAndAdd(0) + } + } + val listener = new StorageStatusListener(localtestconf, ticker) + listener.removedExecutorIdToStorageStatus.put("1", new StorageStatus(null, 50)) + ticker.advance(5, TimeUnit.SECONDS) + assert(listener.removedExecutorIdToStorageStatus.asMap.get("1") == null) --- End diff -- this is more complicated than it needs to be -- no need for an atomic (there is only one thread here) you can just use a long. also I'd check the `removedExecutorStorageStatusList` method, rather than the cache itself. ```scala class MyTicker extends Ticker { var t = 0L override def read(): Long = t } val ticker = new MyTicker val listener = new StorageStatusListener(localtestconf, ticker) listener.removedExecutorIdToStorageStatus.put("1", new StorageStatus(null, 50)) assert(listener.removedExecutorStorageStatusList.nonEmpty) ticker.t = 5000000001L assert(listener.removedExecutorStorageStatusList.isEmpty) ```
--- 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org