xuanyuanking commented on a change in pull request #26201: [SPARK-29543][SS][UI] Init structured streaming ui URL: https://github.com/apache/spark/pull/26201#discussion_r356789038
########## File path: sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/StreamQueryStore.scala ########## @@ -0,0 +1,85 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.spark.sql.execution.streaming + +import java.util.UUID +import java.util.concurrent.ConcurrentHashMap + +import scala.collection.JavaConverters._ + +import org.apache.spark.sql.streaming.StreamingQuery + +/** + * A class that holds [[StreamingQuery]] active across all sessions to manage the lifecycle + * of the stream. + */ +private[sql] class StreamQueryStore { + private val activeStreamingQueries = new ConcurrentHashMap[UUID, (StreamingQuery, Long)]() + // There maybe more than one inactive stream query with same query ID, as we can run same + // stream query many times after it failed or terminated. + private val inactiveStreamingQueries = new ConcurrentHashMap[(UUID, Long), StreamingQuery]() Review comment: IMO, tracking inactive streaming queries is necessary, but we still need to have some strategies for cleanup, e.g., add a config for the max inactive streaming queries number. Also, is there any other way to keep a streaming query status rather than store the whole StreamingQuery instance here? The instance contains even the execution plan, which would be memory consuming. ---------------------------------------------------------------- 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]
