tdas commented on a change in pull request #26225: [SPARK-29568][SS] Stop 
existing running streams when a new stream is launched
URL: https://github.com/apache/spark/pull/26225#discussion_r344415783
 
 

 ##########
 File path: 
sql/core/src/main/scala/org/apache/spark/sql/streaming/StreamingQueryManager.scala
 ##########
 @@ -353,17 +356,44 @@ class StreamingQueryManager private[sql] (sparkSession: 
SparkSession) extends Lo
       }
 
       // Make sure no other query with same id is active across all sessions
-      val activeOption =
-        
Option(sparkSession.sharedState.activeStreamingQueries.putIfAbsent(query.id, 
this))
-      if (activeOption.isDefined || activeQueries.values.exists(_.id == 
query.id)) {
+      val activeOption = 
Option(sparkSession.sharedState.activeStreamingQueries.get(query.id))
+        .orElse(activeQueries.get(query.id))
 
 Review comment:
   why do we need to check both? can it be in the shared state and but not in 
the local one?

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to