davidnavas commented on a change in pull request #24616: [SPARK-27726] [Core] 
Fix performance of ElementTrackingStore deletes when using InMemoryStore under 
high loads
URL: https://github.com/apache/spark/pull/24616#discussion_r284815319
 
 

 ##########
 File path: 
core/src/main/scala/org/apache/spark/status/ElementTrackingStore.scala
 ##########
 @@ -46,7 +50,26 @@ import org.apache.spark.util.kvstore._
  */
 private[spark] class ElementTrackingStore(store: KVStore, conf: SparkConf) 
extends KVStore {
 
-  private val triggers = new HashMap[Class[_], Seq[Trigger[_]]]()
+  private class LatchedTriggers(val triggers: Seq[Trigger[_]]) {
+    val countDeferred = new AtomicInteger(0)
+
+    def fireOnce(f: Seq[Trigger[_]] => Unit): Boolean = {
+      val shouldExecute = countDeferred.compareAndSet(0, 1)
+      if (shouldExecute) {
+        doAsync {
+          countDeferred.set(0)
+          f(triggers)
+        }
+      }
+      shouldExecute
 
 Review comment:
   Hmm, my memory is faulty, this isn't a tri-value.  I'll inline here, sure.
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to