jihoonson commented on a change in pull request #11643: URL: https://github.com/apache/druid/pull/11643#discussion_r700615920
########## File path: sql/src/main/java/org/apache/druid/sql/SqlLifecycleManager.java ########## @@ -0,0 +1,98 @@ +/* + * 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.druid.sql; + +import com.google.common.collect.ImmutableList; +import com.google.errorprone.annotations.concurrent.GuardedBy; +import org.apache.druid.guice.LazySingleton; +import org.apache.druid.sql.SqlLifecycle.State; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * This class manages only _authorized_ {@link SqlLifecycle}s. The main use case of this class is + * tracking running queries so that the cancel API can identify the lifecycles to cancel. + * + * This class is thread-safe as there are 2 or more threads that can access lifecycles at the same time + * for query running or query canceling. + */ +@LazySingleton +public class SqlLifecycleManager Review comment: I see your point, but it seemed like a natural choice to me to add this new class instead of using `QueryScheduler` since `QueryScheduler` is currently designed to manage only native queries. It also has richer functionalities to manage cluster recourse based on query lanes. It doesn't seem like there is a strong reason for merging them at least at this point. Instead of merging them, I added some javadoc about how they are different today, so that our future selves can remember and make a better decision. -- 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. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
