yiguolei commented on code in PR #28443: URL: https://github.com/apache/doris/pull/28443#discussion_r1429639152
########## fe/fe-core/src/main/java/org/apache/doris/resource/workloadschedpolicy/WorkloadSchedPolicyMgr.java: ########## @@ -0,0 +1,509 @@ +// 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.doris.resource.workloadschedpolicy; + +import org.apache.doris.analysis.AlterWorkloadSchedPolicyStmt; +import org.apache.doris.analysis.CreateWorkloadSchedPolicyStmt; +import org.apache.doris.analysis.DropWorkloadSchedPolicyStmt; +import org.apache.doris.analysis.UserIdentity; +import org.apache.doris.catalog.Env; +import org.apache.doris.common.Config; +import org.apache.doris.common.UserException; +import org.apache.doris.common.io.Text; +import org.apache.doris.common.io.Writable; +import org.apache.doris.common.proc.BaseProcResult; +import org.apache.doris.common.proc.ProcResult; +import org.apache.doris.common.util.DebugUtil; +import org.apache.doris.mysql.privilege.PrivPredicate; +import org.apache.doris.persist.gson.GsonPostProcessable; +import org.apache.doris.persist.gson.GsonUtils; +import org.apache.doris.qe.ConnectContext; +import org.apache.doris.service.ExecuteEnv; + +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Maps; +import com.google.gson.annotations.SerializedName; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Comparator; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.PriorityQueue; +import java.util.Queue; +import java.util.Set; +import java.util.concurrent.locks.ReentrantReadWriteLock; + +public class WorkloadSchedPolicyMgr implements Writable, GsonPostProcessable { + + private static final Logger LOG = LogManager.getLogger(WorkloadSchedPolicyMgr.class); + + @SerializedName(value = "idToPolicy") + private Map<Long, WorkloadSchedPolicy> idToPolicy = Maps.newConcurrentMap(); + private Map<String, WorkloadSchedPolicy> nameToPolicy = Maps.newHashMap(); + + private PolicyProcNode policyProcNode = new PolicyProcNode(); + + public static final ImmutableList<String> WORKLOAD_SCHED_POLICY_NODE_TITLE_NAMES + = new ImmutableList.Builder<String>() + .add("Id").add("Name").add("ItemName").add("ItemValue") + .build(); + + private final ReentrantReadWriteLock lock = new ReentrantReadWriteLock(); + + public static Comparator<WorkloadSchedPolicy> policyComparator = new Comparator<WorkloadSchedPolicy>() { + @Override + public int compare(WorkloadSchedPolicy p1, WorkloadSchedPolicy p2) { + return p2.getPriority() - p1.getPriority(); + } + }; + + private Thread policyExecThread = new Thread() { Review Comment: 每一个thread 都需要有一个名字,当定位问题的时候可以看到名字 -- 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: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org