hello-stephen commented on code in PR #71404:
URL: https://github.com/apache/doris/pull/71404#discussion_r4807214160


##########
fe/fe-core/src/main/java/org/apache/doris/job/extensions/mtmv/MTMVTask.java:
##########
@@ -1986,19 +1986,28 @@ private void beforeMTMVRefresh() throws 
AnalysisException, DdlException {
     public void runTask() throws JobException {
         LOG.info("mtmv task runTask, taskId: {}", super.getTaskId());
         MTMVJob job = (MTMVJob) getJobOrJobException();
+        boolean changed = false;
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("mtmv task get writeLock start, taskId: {}", 
super.getTaskId());
+        }
+        job.writeLock();
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("mtmv task get writeLock end, taskId: {}", 
super.getTaskId());
+        }
         try {
-            if (LOG.isDebugEnabled()) {
-                LOG.debug("mtmv task get writeLock start, taskId: {}", 
super.getTaskId());
-            }
-            job.writeLock();
-            if (LOG.isDebugEnabled()) {
-                LOG.debug("mtmv task get writeLock end, taskId: {}", 
super.getTaskId());
+            try {
+                Env.getCurrentEnv().getMtmvService().beginRefresh(mtmvId);
+                super.runTask();
+            } finally {
+                changed = 
Env.getCurrentEnv().getMtmvService().finishRefresh(mtmvId);
+                job.writeUnlock();
+                if (LOG.isDebugEnabled()) {
+                    LOG.debug("mtmv task release writeLock, taskId: {}", 
super.getTaskId());
+                }
             }
-            super.runTask();
         } finally {
-            job.writeUnlock();
-            if (LOG.isDebugEnabled()) {
-                LOG.debug("mtmv task release writeLock, taskId: {}", 
super.getTaskId());
+            if (changed) {
+                
Env.getCurrentEnv().getMtmvService().triggerOnCommitAfterRefresh(dbId, mtmvId);

Review Comment:
   [P3] Exercise downstream dispatch after a partial refresh failure. Each 
batch swaps its partitions independently, so a later failure can leave data 
visible even though the refresh task fails. The unit tests call the service 
methods directly, and the chain suite only waits for successful upstream tasks. 
A change that dispatched only on success would pass those tests and leave the 
downstream view stale. Add a worker-level test that publishes the first batch, 
fails a later batch, and checks for exactly one downstream notification and 
cleanup of the pending state.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to