Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BugFix]The OP_DROP_TABLE_V2 event is not triggered when an error is reported for dropping a materialized view. #53951

Merged
merged 1 commit into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -957,7 +957,22 @@ public void onDrop(Database db, boolean force, boolean replay) {
// 2. Remove from base tables
List<BaseTableInfo> baseTableInfos = getBaseTableInfos();
for (BaseTableInfo baseTableInfo : ListUtils.emptyIfNull(baseTableInfos)) {
Optional<Table> baseTableOpt = MvUtils.getTableWithIdentifier(baseTableInfo);
Optional<Table> 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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Loading