hello-stephen commented on code in PR #71451:
URL: https://github.com/apache/doris/pull/71451#discussion_r4808355994
##########
fe/fe-core/src/main/java/org/apache/doris/mtmv/ivm/IvmFailureReason.java:
##########
@@ -47,13 +47,16 @@ public enum IvmFailureReason {
/**
* Whether COMPLETE is the only refresh that repairs this failure, so that
a refresh allowed to fall back goes
* to it directly instead of trying a partition refresh first.
+ *
+ * <p>{@link #MIN_MAX_BOUNDARY_HIT} and {@link #BITMAP_AGG_DELETE} are
intentionally excluded:
+ * for a partitioned {@code FOLLOW_BASE_TABLE} MV whose changes come from
PCT base partitions,
+ * a {@code PARTITIONS} fallback recomputes only the affected MV
partitions and resets their
Review Comment:
[P3] Update the bitmap-delete failure advice
A strict incremental request still exposes the guard text from
`IvmFailureClassifier.BITMAP_AGG_DELETE_MSG_PREFIX`, which says the delete
`requires COMPLETE`. That now directs users of eligible PCT views to rebuild
the entire MV when an incremental request with fallback can repair the affected
partition. Keep the classification marker recognizable and make the user-facing
detail say that the aggregate needs recomputation.
##########
fe/fe-core/src/main/java/org/apache/doris/job/extensions/mtmv/MTMVTask.java:
##########
@@ -436,6 +436,11 @@ 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);
Review Comment:
[P2] Keep COMPLETE reachable when the partition fallback cannot run
A caught-up non-PCT MoW stream can have an old offset that the delta never
needs to read through. If the PCT delete triggers an aggregate fallback and the
non-PCT table receives an update after the partition scope is chosen, the
partial overwrite now has to reconstruct that table's image at the old offset.
`NormalizeOlapTableStreamScan` rejects that snapshot with `CHANGELOG_BROKEN`
once the offset is outside retention. The partition attempt escalates only
`PLAN_SIGNATURE_MISMATCH`, so a fallback-enabled refresh fails where the
previous `COMPLETE` path could reset the stream and repair the view. Propagate
complete-required failures to the next attempt when fallback is allowed.
The added context rebuild has the same escalation gap. In cloud mode its
batch partition-version lookup can raise `AnalysisException` before partition
planning, and that exits the task immediately. If this optional context refresh
fails, let COMPLETE use the initial context as it did before.
##########
fe/fe-core/src/main/java/org/apache/doris/job/extensions/mtmv/MTMVTask.java:
##########
@@ -1343,6 +1353,13 @@ &&
hasUnusableIvmStreamForPartitions(partitionPlan.context, partitionPlan.partit
return false;
}
if (refreshMode == MTMVTaskRefreshMode.NOT_REFRESH) {
+ if (fallingBack && mtmv.isIvm() &&
isRowLevelAggFallbackReason(ivmFallbackReason)
Review Comment:
[P2] Recheck partitions rebuilt before the failed delta
Consider a three-partition PCT view. The incremental attempt rebuilds dirty
p1 and resets its offset. Then a delete in p1 hits the MIN/MAX or bitmap guard
while an unrelated append is pending in p2. The incremental INSERT still reads
p1's stream. The refreshed fallback context sees both partitions, but
`excludingRebuiltPartitions` drops p1 because it has a task-local snapshot from
before the delete. The p2-only plan succeeds and bypasses this `NOT_REFRESH`
guard, leaving p1's aggregate stale and its delete pending. Keep earlier
partitions in this fallback when their captured versions no longer cover the
work, or use `COMPLETE` when coverage cannot be established.
##########
fe/fe-core/src/main/java/org/apache/doris/mtmv/ivm/IvmFailureReason.java:
##########
@@ -47,13 +47,16 @@ public enum IvmFailureReason {
/**
* Whether COMPLETE is the only refresh that repairs this failure, so that
a refresh allowed to fall back goes
* to it directly instead of trying a partition refresh first.
+ *
+ * <p>{@link #MIN_MAX_BOUNDARY_HIT} and {@link #BITMAP_AGG_DELETE} are
intentionally excluded:
+ * for a partitioned {@code FOLLOW_BASE_TABLE} MV whose changes come from
PCT base partitions,
Review Comment:
[P2] Update the partitioned MIN/MAX regression for the new route
Case 4 of `test_ivm_refresh_method_metrics.groovy` deletes the retained
minimum from January in a three-partition PCT view. A successful fallback now
commits a January-only partition rebuild. The checked-in `!fallback_task` row
still expects `IvmRefreshMethod=COMPLETE`, and the suite expects the `complete`
metric series to increment. Update the assertion to `partition_rebuild` and
regenerate the expected row with `PARTITION_REBUILD`. This fixture can also
assert that only January is rebuilt.
##########
fe/fe-core/src/main/java/org/apache/doris/job/extensions/mtmv/MTMVTask.java:
##########
@@ -436,6 +436,11 @@ public void run() throws JobException {
fallingBack =
givingUpTheIncrementalAttemptIsAFallback();
if (ivmResult ==
AttemptResultType.FALLBACK_TO_COMPLETE) {
disablePartitionRefresh = true;
+ } else {
Review Comment:
[P3] Count partitions committed by the fallback
On a healthy view with one stale PCT partition, this route can report
`IvmRefreshMethod=PARTITION_REBUILD` and list one completed partition while
`IvmRebuiltPartitions` stays 0. The PARTITIONS attempt returns without calling
`recordRebuiltPartitions`, which previously ran in the COMPLETE branch for
these reasons. Record the committed partition count for the new fallback,
including batches that committed before a later batch failed.
--
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]