github-actions[bot] commented on code in PR #68170:
URL: https://github.com/apache/doris/pull/68170#discussion_r4045055271


##########
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:
   **[P1] Persist the COMPLETE guard before replacing streams**
   
   `reconcileIvmStreams` can force-drop and edit-log an unusable stream, then 
edit-log a new `show_initial_rows` stream. This now happens before 
`executePartitionBasedRefresh` calls `getIncrementalTableMap` and 
`persistIvmBaselineGuard`. If the FE stops, setup fails, or the later 
schema-version check rejects the task in that gap, replay keeps the replacement 
stream but no `completeBaselineRebuildRequired` barrier. A subsequent 
incremental refresh can apply that stream's initial snapshot to MV data built 
from the old baseline (for example, double aggregate state) and then consume 
the offsets. Please make the guard durable before any reconciliation; the new 
`STREAM_UNSUPPORTED` classification will still route through COMPLETE.



##########
fe/fe-core/src/main/java/org/apache/doris/mtmv/ivm/IvmFailureReason.java:
##########
@@ -38,6 +38,7 @@ public enum IvmFailureReason {
 
     public boolean requiresCompleteRefresh() {
         return this == BINLOG_BROKEN
+                || this == STREAM_UNSUPPORTED

Review Comment:
   **[P2] Route PARTITIONS FALLBACK around the broken stream**
   
   This predicate is consulted only after an incremental IVM attempt. A 
supported `REFRESH ... PARTITIONS FALLBACK` instead constructs `[PARTITIONS, 
COMPLETE]`, but PARTITIONS installs `IvmRewriteContext.full`; 
`IvmFullRefreshMTMV` calls `getIvmStream`, and the resulting 
`STREAM_UNSUPPORTED` is rethrown, so the loop never reaches 
COMPLETE/reconciliation. That failure also leaves a partial baseline guard, 
causing later fallback-capable requests to fail in 
`handlePendingIvmBaselineRebuild` before their IVM handler. Route or preflight 
this typed failure to a durably guarded COMPLETE before any fallback-authorized 
partition rebuild; keep plain/explicit partition requests as hard failures and 
add task-level coverage.



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