From b6d570bceae93309fc1cd7d4c608964fa5e5c977 Mon Sep 17 00:00:00 2001 From: cambyzhu Date: Wed, 4 Dec 2024 15:47:27 +0800 Subject: [PATCH] make QueryDetailQueue.queryCapacity configurable --- .../src/main/java/org/apache/doris/common/Config.java | 6 ++++++ .../main/java/org/apache/doris/qe/QueryDetailQueue.java | 7 ++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/fe/fe-common/src/main/java/org/apache/doris/common/Config.java b/fe/fe-common/src/main/java/org/apache/doris/common/Config.java index dd09db27d94ba1..94c6ad4b0aa6b9 100644 --- a/fe/fe-common/src/main/java/org/apache/doris/common/Config.java +++ b/fe/fe-common/src/main/java/org/apache/doris/common/Config.java @@ -2464,6 +2464,12 @@ public class Config extends ConfigBase { }) public static int http_load_submitter_max_worker_threads = 2; + @ConfField(mutable = false, masterOnly = false, description = { + "缓存的最大Query数量,用于响应http请求/api/query_detail。", + "The max capacity of queries for query_detail api." + }) + public static int http_query_detail_capacity = 10000; + @ConfField(mutable = true, masterOnly = true, description = { "load label个数阈值,超过该个数后,对于已经完成导入作业或者任务," + "其label会被删除,被删除的 label 可以被重用。 值为 -1 时,表示此阈值不生效。", diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/QueryDetailQueue.java b/fe/fe-core/src/main/java/org/apache/doris/qe/QueryDetailQueue.java index 85f09798a33116..b0d464df337478 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/qe/QueryDetailQueue.java +++ b/fe/fe-core/src/main/java/org/apache/doris/qe/QueryDetailQueue.java @@ -17,6 +17,8 @@ package org.apache.doris.qe; +import org.apache.doris.common.Config; + import com.google.common.collect.Lists; import com.google.common.collect.Maps; @@ -31,9 +33,12 @@ public class QueryDetailQueue { private static Map runningQueries = Maps.newHashMap(); private static LinkedList totalQueries = new LinkedList(); - private static int queryCapacity = 10000; + private static int queryCapacity = Config.http_query_detail_capacity; public static synchronized void addOrUpdateQueryDetail(QueryDetail queryDetail) { + if (queryCapacity <= 0) { + return; + } if (runningQueries.get(queryDetail.getQueryId()) == null) { if (queryDetail.getState() == QueryDetail.QueryMemState.RUNNING) { runningQueries.put(queryDetail.getQueryId(), queryDetail);