yujun777 commented on code in PR #68170:
URL: https://github.com/apache/doris/pull/68170#discussion_r4057013443


##########
fe/fe-core/src/main/java/org/apache/doris/job/extensions/mtmv/MTMVTask.java:
##########
@@ -553,6 +553,12 @@ private void executeCompleteAttempt(MTMVRefreshContext 
context, ConnectContext c
         if (refreshMode == MTMVTaskRefreshMode.NOT_REFRESH) {
             return;
         }
+        // A complete rebuild resets the stream baselines, so reconcile 
missing or unusable streams
+        // first. Only COMPLETE may do this: a stream baseline is global, 
resetting it during a
+        // partial refresh would corrupt the partitions that refresh does not 
touch.
+        if (mtmv.isIvm()) {
+            reconcileIvmStreams(ctx);

Review Comment:
   Addressed in 0044712b546.
   
   The barrier is now written by the caller that decides the partition set, 
before the reconcile runs. `executeCompleteAttempt` reads: decide the 
partitions -> `writeIvmBaselineBarrier(COMPLETE)` -> `reconcileIvmStreams` -> 
refresh, so the barrier is durable (`persistIvmBaselineGuard` journals and 
awaits) before any stream is replaced. The other two callers, the 
pending-baseline pre-step and the partition-based attempt, write theirs the 
same way, and the shared partition refresh no longer writes one itself.
   
   `MTMVTaskTest.testCompleteAttemptWritesTheBarrierBeforeReconcilingStreams` 
pins the order with a Mockito `InOrder` over `persistIvmBaselineGuard` and the 
reconcile's first metadata read, so swapping them back fails the test.



-- 
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