[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
This commit is contained in:
zhangdong
2024-05-27 16:35:13 +08:00
committed by GitHub
parent a32db25070
commit 1a52e4f7db
7 changed files with 27 additions and 13 deletions

View File

@ -51,7 +51,7 @@ public class AlterOperations {
public void checkMTMVAllow(List<AlterClause> 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");
}
}
}

View File

@ -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());
}
}
}

View File

@ -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);

View File

@ -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);
}
}

View File

@ -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);

View File

@ -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) {

View File

@ -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()) {