diff --git a/fe/fe-core/src/main/java/com/starrocks/catalog/MaterializedView.java b/fe/fe-core/src/main/java/com/starrocks/catalog/MaterializedView.java index b10b27588ac38..c2a9c5cfe3056 100644 --- a/fe/fe-core/src/main/java/com/starrocks/catalog/MaterializedView.java +++ b/fe/fe-core/src/main/java/com/starrocks/catalog/MaterializedView.java @@ -957,7 +957,22 @@ public void onDrop(Database db, boolean force, boolean replay) { // 2. Remove from base tables List baseTableInfos = getBaseTableInfos(); for (BaseTableInfo baseTableInfo : ListUtils.emptyIfNull(baseTableInfos)) { - Optional baseTableOpt = MvUtils.getTableWithIdentifier(baseTableInfo); + Optional
baseTableOpt; + try { + baseTableOpt = MvUtils.getTableWithIdentifier(baseTableInfo); + } catch (Exception e) { + if (!(baseTableInfo.isInternalCatalog())) { + GlobalStateMgr.getCurrentState().getConnectorTblMetaInfoMgr(). + removeConnectorTableInfo(baseTableInfo.getCatalogName(), + baseTableInfo.getDbName(), + baseTableInfo.getTableIdentifier(), + ConnectorTableInfo.builder().setRelatedMaterializedViews( + Sets.newHashSet(mvId)).build()); + } + LOG.error("Failed to get base table: {}", baseTableInfo, e); + continue; + } + if (baseTableOpt.isPresent()) { Table baseTable = baseTableOpt.get(); baseTable.removeRelatedMaterializedView(mvId); diff --git a/fe/fe-core/src/main/java/com/starrocks/qe/DDLStmtExecutor.java b/fe/fe-core/src/main/java/com/starrocks/qe/DDLStmtExecutor.java index 82270b38710fb..fa79e2a88a79c 100644 --- a/fe/fe-core/src/main/java/com/starrocks/qe/DDLStmtExecutor.java +++ b/fe/fe-core/src/main/java/com/starrocks/qe/DDLStmtExecutor.java @@ -178,7 +178,8 @@ public static ShowResultSet execute(StatementBase stmt, ConnectContext context) } else if (re.getCause() instanceof IOException) { throw (IOException) re.getCause(); } else if (re.getCause() != null) { - throw new DdlException(re.getCause().getMessage(), re); + throw new DdlException(re.getCause().getMessage() != null ? + re.getCause().getMessage() : re.getMessage(), re); } else { throw re; }