This is an automated email from the ASF dual-hosted git repository. morrysnow pushed a commit to branch 2.1_47771 in repository https://gitbox.apache.org/repos/asf/doris.git
commit 9a226f41c1917b22b4687a891dba5e8875b3585b Author: morrySnow <zhangwen...@selectdb.com> AuthorDate: Thu Feb 13 15:55:56 2025 +0800 branch-2.1: [opt](Nereids) avoid lock failed if async mv has invalid base info #47771 pick from master #47771 Problem Summary: sometimes, after upgrade, async mv may has invalid base table info. when do lock before plan, we should skip these infos to avoid lock failed. --- .../src/main/java/org/apache/doris/mtmv/BaseTableInfo.java | 4 ++++ .../apache/doris/nereids/rules/analysis/CollectRelation.java | 11 ++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/mtmv/BaseTableInfo.java b/fe/fe-core/src/main/java/org/apache/doris/mtmv/BaseTableInfo.java index 44183c38fef..2f0810c7a72 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/mtmv/BaseTableInfo.java +++ b/fe/fe-core/src/main/java/org/apache/doris/mtmv/BaseTableInfo.java @@ -122,6 +122,10 @@ public class BaseTableInfo { } } + public boolean isValid() { + return ctlName != null && dbName != null && tableName != null; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/CollectRelation.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/CollectRelation.java index 24a85356aba..755f6aa9472 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/CollectRelation.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/CollectRelation.java @@ -204,13 +204,18 @@ public class CollectRelation implements AnalysisRuleFactory { mtmv.readMvLock(); try { for (BaseTableInfo baseTableInfo : mtmv.getRelation().getBaseTables()) { - LOG.info("mtmv {} related base table include {}", new BaseTableInfo(mtmv), baseTableInfo); + if (!baseTableInfo.isValid()) { + continue; + } + if (LOG.isDebugEnabled()) { + LOG.debug("mtmv {} related base table include {}", new BaseTableInfo(mtmv), baseTableInfo); + } try { cascadesContext.getStatementContext().getAndCacheTable(baseTableInfo.toList(), TableFrom.MTMV); } catch (AnalysisException exception) { - LOG.warn("mtmv related base table get err, related table is " - + baseTableInfo.toList(), exception); + LOG.warn("mtmv related base table get err, related table is {}", + baseTableInfo.toList(), exception); } } } finally { --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org