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


##########
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:
   Fixed in 665f86bd5f7.
   
   Both halves hold, and the comment the pre-step carried was wrong: 
`handlePendingIvmBaselineRebuild` runs before the attempts do, and `PARTITIONS 
FALLBACK` builds `[PARTITIONS, COMPLETE]`, so the list it is handed here holds 
no IVM attempt for `buildAttempts` to have judged.
   
   The pre-step now judges exactly what it is about to read, at the point it 
knows it: `baselinePartitions` is decided first, then 
`hasUnusableIvmStreamForPartitions(context, baselinePartitions)` -- the 
predicate the partition attempt already uses, over the set the reset read mode 
is built from (every non-PCT table of the plan, plus the PCT tables the rebuilt 
partitions' mappings name). Only when that passes does it write its barrier and 
call the low-level refresh.
   
   - A request that may fall back becomes `[COMPLETE]` and returns without 
writing a barrier: a fresh barrier would have guarded nothing but the data the 
rebuild never wrote, and COMPLETE reconciles the stream and clears the barrier 
that is already pending.
   - A request that may not fall back fails before the rebuild starts, as it 
does in the partition attempt, rather than running a rebuild that throws 
`STREAM_UNSUPPORTED` out of `IvmFullRefreshMTMV`.
   
   `needRefreshPartitions` / `refreshMode` moved below the check, so the 
fallback path has no field to roll back.
   
   Coverage: 
`MTMVTaskTest.testPendingBaselineRebuildChecksTheStreamsItsPartitionsRead` -- a 
non-empty partial barrier plus a stream missing for a table the rebuild reads. 
On the previous head it fails with `expected: <[COMPLETE]> but was: 
<[PARTITIONS, COMPLETE]>`, i.e. the pre-step runs the rebuild; the strict half 
asserts the failure. There is no regression case for this shape: reaching the 
state needs a partial refresh that fails *after* its barrier is written, and no 
debug point injects a failure there (`IvmIncrRefreshManager`'s force-fallback 
point and `TableStreamManager`'s block point are the only ones on this path, 
and neither fails it), so I did not fake one. Both stream-scope suites of this 
PR still pass unchanged: 
`mtmv_p0/ivm/test_ivm_partitions_fallback_stream_unusable` and 
`test_ivm_chained_stream_scope`.
   
   Verification on this head: `MTMVTaskTest` 49/49, `IvmBaselineRebuildTest` 
28/28, `IvmFailureReasonTest` 1/1, `checkstyle:check` clean, and the two suites 
above green on a local cluster built from it.
   



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