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


##########
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:
   Addressed in 0044712b546, by deciding the attempt list up front rather than 
by routing a failure after the fact.
   
   `buildAttempts` now asks whether the MV has a base table without a usable 
stream. When the request allows fallback, the attempts become `[COMPLETE]`: the 
incremental rewrite reads the stream of every base table and a partition 
refresh reads those of the PCT tables it realigns as well 
(`collectPctResetPartitionIds` feeds `IvmFullRefreshMTMV` RESET reads), so no 
other attempt can succeed, and COMPLETE is the only one that reconciles. That 
also skips the partition attempt's partial barrier altogether. `[COMPLETE]` -- 
rather than `[IVM, COMPLETE]` -- because `MTMV.validateIvmRefreshStart` rejects 
an IVM attempt while a baseline barrier is pending. The pending-baseline 
pre-step then bows out through its existing "covered by the pending COMPLETE 
attempt" branch, and a request that does not allow fallback still fails as 
before: COMPLETE would refresh more than it asked for.
   
   The stream check is the one the reconcile already uses (extracted into 
`usableIvmStream`), and it iterates the same `relation.getBaseTables()` the 
reconcile provisions streams for, so there is no separate predicate to keep in 
sync.
   
   Verified end to end: with the MV's streams dropped by hand, `REFRESH 
MATERIALIZED VIEW mv PARTITIONS FALLBACK` now succeeds with 
`RefreshMode=COMPLETE` and `IvmFallbackReason=STREAM_UNSUPPORTED`, and the 
COMPLETE attempt recreates the streams; strict `REFRESH ... PARTITIONS` still 
fails with `IVM stream not found`. Added 
`regression-test/suites/mtmv_p0/ivm/test_ivm_partitions_fallback_stream_unusable`
 for exactly that pair, including a task-level assertion.
   
   One boundary worth stating: a stream that becomes unusable between this 
check and the read still fails that refresh. The barrier then survives, and the 
next refresh starts from the same check, sees the stream is gone and rebuilds 
through COMPLETE -- so it recovers on the following run instead of needing an 
explicit REFRESH COMPLETE.



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