Skip to content

Commit

Permalink
[opt](Nereids) avoid lock failed if async mv has invalid base info (#…
Browse files Browse the repository at this point in the history
…47771)

### What problem does this PR solve?

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.
  • Loading branch information
morrySnow authored Feb 13, 2025
1 parent 86e1378 commit 11bb112
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,10 @@ public boolean isInternalTable() {
}
}

public boolean isValid() {
return ctlName != null && dbName != null && tableName != null;
}

@Override
public boolean equals(Object o) {
if (this == o) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,15 +207,18 @@ private void collectMTMVCandidates(TableIf table, CascadesContext cascadesContex
mtmv.readMvLock();
try {
for (BaseTableInfo baseTableInfo : mtmv.getRelation().getBaseTables()) {
if (!baseTableInfo.isValid()) {
continue;
}
if (LOG.isDebugEnabled()) {
LOG.info("mtmv {} related base table include {}", new BaseTableInfo(mtmv), baseTableInfo);
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 {
Expand Down

0 comments on commit 11bb112

Please sign in to comment.