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


##########
fe/fe-core/src/main/java/org/apache/doris/job/extensions/mtmv/MTMVTask.java:
##########
@@ -436,14 +436,23 @@ public void run() throws JobException {
                         fallingBack = 
givingUpTheIncrementalAttemptIsAFallback();
                         if (ivmResult == 
AttemptResultType.FALLBACK_TO_COMPLETE) {
                             disablePartitionRefresh = true;
+                        } else {
+                            // Rebuild refreshContext so the PARTITIONS 
fallback sees any base-table
+                            // commits that arrived after the initial context 
build and triggered IVM
+                            // fallback (e.g. MIN_MAX_BOUNDARY_HIT / 
BITMAP_AGG_DELETE).
+                            refreshContext = buildRefreshContext(tableIfs);
                         }
                         break;
                     case PARTITIONS:
                         if (disablePartitionRefresh) {
                             break;
                         }
-                        if (executePartitionBasedRefresh(refreshContext, 
request, ctx)) {
-                            return;
+                        try {
+                            if (executePartitionBasedRefresh(refreshContext, 
request, ctx)) {
+                                return;
+                            }
+                        } finally {
+                            recordRebuiltPartitions(request);

Review Comment:
   [P2] Preserve rebuild counts for existing PARTITIONS routes
   
   This now counts every successful PARTITIONS attempt, including requests that 
asked for that work. After a failed COMPLETE marks both partitions, the direct 
PARTITIONS and PARTITIONS FALLBACK cases in 
`test_ivm_partitions_after_failed_complete` each commit both and now report 2 
instead of the expected 0. The older `PLAN_PATTERN_UNSUPPORTED` fallback in 
`test_ivm_fallback_keeps_the_whole_scope` likewise changes from 1 to 2. Scope 
the added count to the new aggregate fallback, or explicitly change the 
accounting contract and update the affected fixtures.



##########
fe/fe-core/src/main/java/org/apache/doris/job/extensions/mtmv/MTMVTask.java:
##########
@@ -1352,7 +1395,8 @@ && 
hasUnusableIvmStreamForPartitions(partitionPlan.context, partitionPlan.partit
         } catch (JobException e) {
             Optional<IvmFailureReason> reason = 
IvmFailureClassifier.classifyExecutionFailure(
                     Util.getRootCauseMessage(e))
-                    .filter(candidate -> candidate == 
IvmFailureReason.PLAN_SIGNATURE_MISMATCH);
+                    .filter(candidate -> candidate == 
IvmFailureReason.PLAN_SIGNATURE_MISMATCH

Review Comment:
   [P2] Reach COMPLETE if a stream disappears after preflight
   
   If an internal stream is force-dropped after 
`hasUnusableIvmStreamForPartitions` checks it, the partition overwrite planner 
looks it up again and reports `IvmException(STREAM_UNSUPPORTED)`. The text 
classifier here doesn't recognize the missing-stream error, so the 
fallback-enabled refresh fails instead of reaching `reconcileIvmStreams`, which 
can recreate it. This is separate from the expired-offset case. Preserve the 
planner's reason through the wrapper and let COMPLETE handle this error when 
fallback is allowed.



##########
fe/fe-core/src/main/java/org/apache/doris/job/extensions/mtmv/MTMVTask.java:
##########
@@ -1352,7 +1395,8 @@ && 
hasUnusableIvmStreamForPartitions(partitionPlan.context, partitionPlan.partit
         } catch (JobException e) {
             Optional<IvmFailureReason> reason = 
IvmFailureClassifier.classifyExecutionFailure(
                     Util.getRootCauseMessage(e))
-                    .filter(candidate -> candidate == 
IvmFailureReason.PLAN_SIGNATURE_MISMATCH);
+                    .filter(candidate -> candidate == 
IvmFailureReason.PLAN_SIGNATURE_MISMATCH
+                            || candidate == IvmFailureReason.CHANGELOG_BROKEN);

Review Comment:
   [P3] Log the actual reason for escalation
   
   When an expired offset is classified as `CHANGELOG_BROKEN`, the warning 
below still says “signature mismatch.” Include `reasonName` so the log 
identifies the retention problem rather than pointing operators to a layout 
mismatch.



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