[refacotr](optimizer) Remove useless check #24237

Check stats table status at first
Comment histgram_tbl check since it useless for now
Do preheat both in master and follower
This commit is contained in:
AKIRA
2023-09-14 20:35:56 +09:00
committed by GitHub
parent 6fe207eb4b
commit c6a92955ca
3 changed files with 13 additions and 10 deletions

View File

@ -1613,6 +1613,9 @@ public class Env {
// stop mtmv scheduler
mtmvJobManager.stop();
if (analysisManager != null) {
analysisManager.getStatisticsCache().preHeat();
}
}
// Set global variable 'lower_case_table_names' only when the cluster is initialized.

View File

@ -281,6 +281,9 @@ public class AnalysisManager extends Daemon implements Writable {
}
public void createAnalyze(AnalyzeStmt analyzeStmt, boolean proxy) throws DdlException {
if (!StatisticsUtil.statsTblAvailable() && !FeConstants.runningUnitTest) {
throw new DdlException("Stats table not available, please make sure your cluster status is normal");
}
if (analyzeStmt instanceof AnalyzeDBStmt) {
createAnalysisJobs((AnalyzeDBStmt) analyzeStmt, proxy);
} else if (analyzeStmt instanceof AnalyzeTblStmt) {
@ -350,11 +353,7 @@ public class AnalysisManager extends Daemon implements Writable {
@Nullable
@VisibleForTesting
public AnalysisInfo buildAndAssignJob(AnalyzeTblStmt stmt) throws DdlException {
if (!StatisticsUtil.statsTblAvailable() && !FeConstants.runningUnitTest) {
throw new DdlException("Stats table not available, please make sure your cluster status is normal");
}
protected AnalysisInfo buildAndAssignJob(AnalyzeTblStmt stmt) throws DdlException {
AnalysisInfo jobInfo = buildAnalysisJobInfo(stmt);
if (jobInfo.colToPartitions.isEmpty()) {
// No statistics need to be collected or updated

View File

@ -400,11 +400,12 @@ public class StatisticsUtil {
.findTable(InternalCatalog.INTERNAL_CATALOG_NAME,
dbName,
StatisticConstants.STATISTIC_TBL_NAME));
statsTbls.add(
(OlapTable) StatisticsUtil
.findTable(InternalCatalog.INTERNAL_CATALOG_NAME,
dbName,
StatisticConstants.HISTOGRAM_TBL_NAME));
// uncomment it when hist is available for user.
// statsTbls.add(
// (OlapTable) StatisticsUtil
// .findTable(InternalCatalog.INTERNAL_CATALOG_NAME,
// dbName,
// StatisticConstants.HISTOGRAM_TBL_NAME));
} catch (Throwable t) {
return false;
}