From 1a52e4f7dbb0a497cd7d3032cf8de657907150c8 Mon Sep 17 00:00:00 2001 From: zhangdong <493738387@qq.com> Date: Mon, 27 May 2024 16:35:13 +0800 Subject: [PATCH] [chore](mtmv)Optimize mtmv logs and exception information (#34957) (#35446) pick from master #34957 1. Change some logs to debug. 2. Error prompt changed from MTMV to async materialized view --- .../apache/doris/alter/AlterOperations.java | 2 +- .../doris/job/extensions/mtmv/MTMVTask.java | 24 ++++++++++++++----- .../mtmv/MTMVPartitionExprDateTrunc.java | 3 ++- .../doris/mtmv/MTMVPartitionExprFactory.java | 4 ++-- ...elatedPartitionDescSyncLimitGenerator.java | 3 ++- .../plans/commands/info/CreateMTMVInfo.java | 2 +- .../MvInfosTableValuedFunction.java | 2 +- 7 files changed, 27 insertions(+), 13 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/alter/AlterOperations.java b/fe/fe-core/src/main/java/org/apache/doris/alter/AlterOperations.java index f7ce1ea56f..ba5175b6fa 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/alter/AlterOperations.java +++ b/fe/fe-core/src/main/java/org/apache/doris/alter/AlterOperations.java @@ -51,7 +51,7 @@ public class AlterOperations { public void checkMTMVAllow(List alterClauses) throws DdlException { for (AlterClause alterClause : alterClauses) { if (!(alterClause.allowOpMTMV())) { - throw new DdlException("Not allowed to perform current operation on MTMV"); + throw new DdlException("Not allowed to perform current operation on async materialized view"); } } } diff --git a/fe/fe-core/src/main/java/org/apache/doris/job/extensions/mtmv/MTMVTask.java b/fe/fe-core/src/main/java/org/apache/doris/job/extensions/mtmv/MTMVTask.java index 71051be395..240c7de6a7 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/job/extensions/mtmv/MTMVTask.java +++ b/fe/fe-core/src/main/java/org/apache/doris/job/extensions/mtmv/MTMVTask.java @@ -154,7 +154,9 @@ public class MTMVTask extends AbstractTask { @Override public void run() throws JobException { - LOG.info("mtmv task run, taskId: {}", super.getTaskId()); + if (LOG.isDebugEnabled()) { + LOG.debug("mtmv task run, taskId: {}", super.getTaskId()); + } ConnectContext ctx = MTMVPlanUtil.createMTMVContext(mtmv); try { if (LOG.isDebugEnabled()) { @@ -244,7 +246,9 @@ public class MTMVTask extends AbstractTask { @Override public synchronized void onSuccess() throws JobException { - LOG.info("mtmv task onSuccess, taskId: {}", super.getTaskId()); + if (LOG.isDebugEnabled()) { + LOG.debug("mtmv task onSuccess, taskId: {}", super.getTaskId()); + } super.onSuccess(); after(); } @@ -260,7 +264,9 @@ public class MTMVTask extends AbstractTask { @Override public void before() throws JobException { - LOG.info("mtmv task before, taskId: {}", super.getTaskId()); + if (LOG.isDebugEnabled()) { + LOG.debug("mtmv task before, taskId: {}", super.getTaskId()); + } super.before(); try { mtmv = MTMVUtil.getMTMV(dbId, mtmvId); @@ -293,13 +299,19 @@ public class MTMVTask extends AbstractTask { LOG.info("mtmv task runTask, taskId: {}", super.getTaskId()); MTMVJob job = (MTMVJob) getJobOrJobException(); try { - LOG.info("mtmv task get writeLock start, taskId: {}", super.getTaskId()); + if (LOG.isDebugEnabled()) { + LOG.debug("mtmv task get writeLock start, taskId: {}", super.getTaskId()); + } job.writeLock(); - LOG.info("mtmv task get writeLock end, taskId: {}", super.getTaskId()); + if (LOG.isDebugEnabled()) { + LOG.debug("mtmv task get writeLock end, taskId: {}", super.getTaskId()); + } super.runTask(); } finally { job.writeUnlock(); - LOG.info("mtmv task release writeLock, taskId: {}", super.getTaskId()); + if (LOG.isDebugEnabled()) { + LOG.debug("mtmv task release writeLock, taskId: {}", super.getTaskId()); + } } } diff --git a/fe/fe-core/src/main/java/org/apache/doris/mtmv/MTMVPartitionExprDateTrunc.java b/fe/fe-core/src/main/java/org/apache/doris/mtmv/MTMVPartitionExprDateTrunc.java index e1991ab292..a42fae2258 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/mtmv/MTMVPartitionExprDateTrunc.java +++ b/fe/fe-core/src/main/java/org/apache/doris/mtmv/MTMVPartitionExprDateTrunc.java @@ -203,7 +203,8 @@ public class MTMVPartitionExprDateTrunc implements MTMVPartitionExprService { result = value.plusDays(1L); break; default: - throw new AnalysisException("MTMV partition roll up not support timeUnit: " + timeUnit); + throw new AnalysisException( + "async materialized view partition roll up not support timeUnit: " + timeUnit); } if (!(result instanceof DateTimeV2Literal)) { throw new AnalysisException("sub() should return DateTimeLiteral, result: " + result); diff --git a/fe/fe-core/src/main/java/org/apache/doris/mtmv/MTMVPartitionExprFactory.java b/fe/fe-core/src/main/java/org/apache/doris/mtmv/MTMVPartitionExprFactory.java index 0fc9a067fa..1093399450 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/mtmv/MTMVPartitionExprFactory.java +++ b/fe/fe-core/src/main/java/org/apache/doris/mtmv/MTMVPartitionExprFactory.java @@ -27,13 +27,13 @@ import org.apache.doris.common.AnalysisException; public class MTMVPartitionExprFactory { public static MTMVPartitionExprService getExprService(Expr expr) throws AnalysisException { if (!(expr instanceof FunctionCallExpr)) { - throw new AnalysisException("now mtmv partition only support FunctionCallExpr"); + throw new AnalysisException("now async materialized view partition only support FunctionCallExpr"); } FunctionCallExpr functionCallExpr = (FunctionCallExpr) expr; String fnName = functionCallExpr.getFnName().getFunction().toLowerCase(); if ("date_trunc".equals(fnName)) { return new MTMVPartitionExprDateTrunc(functionCallExpr); } - throw new AnalysisException("MTMV partition not support function name: " + fnName); + throw new AnalysisException("async materialized view partition not support function name: " + fnName); } } diff --git a/fe/fe-core/src/main/java/org/apache/doris/mtmv/MTMVRelatedPartitionDescSyncLimitGenerator.java b/fe/fe-core/src/main/java/org/apache/doris/mtmv/MTMVRelatedPartitionDescSyncLimitGenerator.java index c6fb331631..3bdcc1c57b 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/mtmv/MTMVRelatedPartitionDescSyncLimitGenerator.java +++ b/fe/fe-core/src/main/java/org/apache/doris/mtmv/MTMVRelatedPartitionDescSyncLimitGenerator.java @@ -132,7 +132,8 @@ public class MTMVRelatedPartitionDescSyncLimitGenerator implements MTMVRelatedPa result = DateTimeArithmetic.monthsSub(date, integerLiteral); break; default: - throw new AnalysisException("MTMV partition limit not support timeUnit: " + timeUnit.name()); + throw new AnalysisException( + "async materialized view partition limit not support timeUnit: " + timeUnit.name()); } if (!(result instanceof DateTimeLiteral)) { throw new AnalysisException("sub() should return DateTimeLiteral, result: " + result); diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/info/CreateMTMVInfo.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/info/CreateMTMVInfo.java index b4b85973b8..6b008ba256 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/info/CreateMTMVInfo.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/info/CreateMTMVInfo.java @@ -160,7 +160,7 @@ public class CreateMTMVInfo { columns.forEach(c -> c.validate(true, keysSet, finalEnableMergeOnWrite, KeysType.DUP_KEYS)); if (distribution == null) { - throw new AnalysisException("Create MTMV should contain distribution desc"); + throw new AnalysisException("Create async materialized view should contain distribution desc"); } if (properties == null) { diff --git a/fe/fe-core/src/main/java/org/apache/doris/tablefunction/MvInfosTableValuedFunction.java b/fe/fe-core/src/main/java/org/apache/doris/tablefunction/MvInfosTableValuedFunction.java index fbc414e717..4135173c34 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/tablefunction/MvInfosTableValuedFunction.java +++ b/fe/fe-core/src/main/java/org/apache/doris/tablefunction/MvInfosTableValuedFunction.java @@ -92,7 +92,7 @@ public class MvInfosTableValuedFunction extends MetadataTableValuedFunction { } String dbName = validParams.get(DB); if (dbName == null) { - throw new AnalysisException("Invalid mtmv metadata query"); + throw new AnalysisException("Invalid async materialized view metadata query"); } this.databaseName = dbName; if (LOG.isDebugEnabled()) {