brkyvz commented on issue #26225: [SPARK-29568][SS] Stop existing running streams when a new stream is launched URL: https://github.com/apache/spark/pull/26225#issuecomment-552154350 There's a deadlock if you stop it there. It's mentioned in the comment above On Sat, Nov 9, 2019, 5:43 PM Dongjoon Hyun <[email protected]> wrote: > *@dongjoon-hyun* commented on this pull request. > ------------------------------ > > In > sql/core/src/main/scala/org/apache/spark/sql/streaming/StreamingQueryManager.scala > <https://github.com/apache/spark/pull/26225#discussion_r344468786>: > > > @@ -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)) > + > + val turnOffOldStream = > + sparkSession.sessionState.conf.getConf(SQLConf.STOP_RUNNING_DUPLICATE_STREAM) > + if (activeOption.isDefined && turnOffOldStream) { > + val oldQuery = activeOption.get > + logWarning(s"Stopping existing streaming query [id=${query.id}, runId=${oldQuery.runId}]," + > + " as a new run is being started.") > + Some(oldQuery) > > Then, we don't need val activeDuplicateQuery = declararion. > > — > You are receiving this because you were mentioned. > Reply to this email directly, view it on GitHub > <https://github.com/apache/spark/pull/26225?email_source=notifications&email_token=ABIAE6Z24SHPQ5JR7SV4O6TQS5RNJA5CNFSM4JD6YV42YY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOCLADEHQ#discussion_r344468786>, > or unsubscribe > <https://github.com/notifications/unsubscribe-auth/ABIAE64Q7YQRTIBESZUIUPDQS5RNJANCNFSM4JD6YV4Q> > . >
---------------------------------------------------------------- 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]
