zddr commented on code in PR #49041:
URL: https://github.com/apache/doris/pull/49041#discussion_r2053792639


##########
fe/fe-core/src/main/java/org/apache/doris/mtmv/MTMVService.java:
##########
@@ -207,12 +209,19 @@ public void processEvent(Event event) throws 
EventException {
         }
     }
 
-    private boolean canRefresh(MTMV mtmv, TableIf table)   {
+    private boolean canRefresh(MTMV mtmv, TableIf table) {
         if (mtmv.getExcludedTriggerTables().contains(table.getName())) {
             LOG.info("skip refresh mtmv: {}, because exclude trigger table: 
{}",
                     mtmv.getName(), table.getName());
             return false;
         }
+        // replace/alter base table,not change MTMVRelation, only change MTMV 
to schema_change,
+        // Therefore, it may trigger incorrect materialized view refresh
+        if (mtmv.getStatus().getState().equals(MTMVState.SCHEMA_CHANGE)) {
+            LOG.info("skip refresh mtmv: {}, because state is SCHEMA_CHANGE, 
trigger table: {}",
+                    mtmv.getName(), table.getName());
+            return false;
+        }

Review Comment:
   only handle commit trigger



##########
fe/fe-core/src/main/java/org/apache/doris/mtmv/MTMVService.java:
##########
@@ -207,12 +209,19 @@ public void processEvent(Event event) throws 
EventException {
         }
     }
 
-    private boolean canRefresh(MTMV mtmv, TableIf table)   {
+    private boolean canRefresh(MTMV mtmv, TableIf table) {
         if (mtmv.getExcludedTriggerTables().contains(table.getName())) {
             LOG.info("skip refresh mtmv: {}, because exclude trigger table: 
{}",
                     mtmv.getName(), table.getName());
             return false;
         }
+        // replace/alter base table,not change MTMVRelation, only change MTMV 
to schema_change,
+        // Therefore, it may trigger incorrect materialized view refresh
+        if (mtmv.getStatus().getState().equals(MTMVState.SCHEMA_CHANGE)) {
+            LOG.info("skip refresh mtmv: {}, because state is SCHEMA_CHANGE, 
trigger table: {}",
+                    mtmv.getName(), table.getName());
+            return false;
+        }
         return 
mtmv.getRefreshInfo().getRefreshTriggerInfo().getRefreshTrigger().equals(RefreshTrigger.COMMIT);

Review Comment:
   ok



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to