From d9e4127cf1bfb1085503e40a6d4c4192ec25b084 Mon Sep 17 00:00:00 2001 From: Murphy <96611012+murphyatwork@users.noreply.github.com> Date: Wed, 8 Jan 2025 16:16:15 +0800 Subject: [PATCH] [BugFix] fix check default analyze job (#54733) Signed-off-by: Murphy (cherry picked from commit 6bbcbf9416242f43259aed876222d7ad35642420) --- .../main/java/com/starrocks/statistic/NativeAnalyzeJob.java | 4 ++++ .../java/com/starrocks/statistic/StatisticAutoCollector.java | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/fe/fe-core/src/main/java/com/starrocks/statistic/NativeAnalyzeJob.java b/fe/fe-core/src/main/java/com/starrocks/statistic/NativeAnalyzeJob.java index b44531ae82073..a7f5913fda1c6 100644 --- a/fe/fe-core/src/main/java/com/starrocks/statistic/NativeAnalyzeJob.java +++ b/fe/fe-core/src/main/java/com/starrocks/statistic/NativeAnalyzeJob.java @@ -204,6 +204,10 @@ public boolean isAnalyzeAllTable() { return tableId == StatsConstants.DEFAULT_ALL_ID; } + public boolean isDefaultJob() { + return isAnalyzeAllDb() && isAnalyzeAllTable() && getScheduleType() == ScheduleType.SCHEDULE; + } + @Override public List instantiateJobs() { return StatisticsCollectJobFactory.buildStatisticsCollectJob(this); diff --git a/fe/fe-core/src/main/java/com/starrocks/statistic/StatisticAutoCollector.java b/fe/fe-core/src/main/java/com/starrocks/statistic/StatisticAutoCollector.java index 22cfecacad32a..62855dbd68e4d 100644 --- a/fe/fe-core/src/main/java/com/starrocks/statistic/StatisticAutoCollector.java +++ b/fe/fe-core/src/main/java/com/starrocks/statistic/StatisticAutoCollector.java @@ -152,7 +152,7 @@ public List runJobs() { private void initDefaultJob() { List allNativeAnalyzeJobs = GlobalStateMgr.getCurrentState().getAnalyzeMgr().getAllNativeAnalyzeJobList(); - if (allNativeAnalyzeJobs.stream().anyMatch(j -> j.getScheduleType() == ScheduleType.SCHEDULE)) { + if (allNativeAnalyzeJobs.stream().anyMatch(NativeAnalyzeJob::isDefaultJob)) { return; }