Skip to content

Commit

Permalink
[BugFix] Fix materialized view cannot refresh in different database. (#…
Browse files Browse the repository at this point in the history
…52295)

Signed-off-by: crossoverJie <[email protected]>
(cherry picked from commit d0a3e32)

# Conflicts:
#	fe/fe-core/src/main/java/com/starrocks/server/LocalMetastore.java
#	fe/fe-core/src/test/java/com/starrocks/analysis/RefreshMaterializedViewTest.java
  • Loading branch information
crossoverJie authored and mergify[bot] committed Oct 30, 2024
1 parent d665d86 commit 80fbe0d
Show file tree
Hide file tree
Showing 2 changed files with 450 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4583,13 +4583,22 @@ public void truncateTable(TruncateTableStmt truncateTableStmt) throws DdlExcepti
// refresh mv
Set<MvId> relatedMvs = olapTable.getRelatedMaterializedViews();
for (MvId mvId : relatedMvs) {
<<<<<<< HEAD
MaterializedView materializedView = (MaterializedView) db.getTable(mvId.getId());
=======
MaterializedView materializedView = (MaterializedView) getTable(mvId.getDbId(), mvId.getId());
>>>>>>> d0a3e3256c ([BugFix] Fix materialized view cannot refresh in different database. (#52295))
if (materializedView == null) {
LOG.warn("Table related materialized view {} can not be found", mvId.getId());
LOG.warn("Table related materialized view {}.{} can not be found", mvId.getDbId(), mvId.getId());
continue;
}
if (materializedView.isLoadTriggeredRefresh()) {
<<<<<<< HEAD
refreshMaterializedView(db.getFullName(), db.getTable(mvId.getId()).getName(), false, null,
=======
Database mvDb = getDb(mvId.getDbId());
refreshMaterializedView(mvDb.getFullName(), getTable(mvDb.getId(), mvId.getId()).getName(), false, null,
>>>>>>> d0a3e3256c ([BugFix] Fix materialized view cannot refresh in different database. (#52295))
Constants.TaskRunPriority.NORMAL.value(), true, false);
}
}
Expand Down
Loading

0 comments on commit 80fbe0d

Please sign in to comment.