Skip to content

Commit

Permalink
[BugFix] Only trigger to inactive mv in leader fe (backport #56308) (#…
Browse files Browse the repository at this point in the history
…56325)

Co-authored-by: shuming.li <[email protected]>
  • Loading branch information
mergify[bot] and LiShuMing authored Feb 27, 2025
1 parent 300a41c commit 3f79ce4
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,8 @@ private void updateTaskDefinition(MaterializedView materializedView) {
* Inactive the materialized view and its related materialized views.
*/
private static void doInactiveMaterializedView(MaterializedView mv, String reason) {
if (mv == null) {
// Only check this in leader and not replay to avoid duplicate inactive
if (mv == null || !GlobalStateMgr.getCurrentState().isLeader()) {
return;
}
LOG.warn("Inactive MV {}/{} because {}", mv.getName(), mv.getId(), reason);
Expand Down Expand Up @@ -563,6 +564,10 @@ public static void inactiveRelatedMaterializedViews(Database db,
"table:{}, modifiedColumns:{}", olapTable.getName(), modifiedColumns);
return;
}
// Only check this in leader and not replay to avoid duplicate inactive
if (!GlobalStateMgr.getCurrentState().isLeader()) {
return;
}
// inactive related asynchronous mvs
for (MvId mvId : olapTable.getRelatedMaterializedViews()) {
MaterializedView mv = (MaterializedView) GlobalStateMgr.getCurrentState().getLocalMetastore()
Expand Down

0 comments on commit 3f79ce4

Please sign in to comment.