github-actions[bot] commented on code in PR #68170:
URL: https://github.com/apache/doris/pull/68170#discussion_r4060627922
##########
fe/fe-core/src/main/java/org/apache/doris/job/extensions/mtmv/MTMVTask.java:
##########
@@ -855,6 +889,51 @@ private void
executePartitionBasedRefresh(MTMVRefreshContext context, RefreshMod
mtmv.getDatabase().getFullName(), mtmv.getName(), getTaskId());
}
+ /**
+ * Whether a base table of the MV has no stream that can be read, which no
attempt other than
+ * COMPLETE can work around.
+ *
+ * <p>A base table that cannot be resolved is skipped rather than judged:
it says nothing about the
+ * streams, and the refresh fails on it for its own reasons -- the attempt
that runs reports that,
+ * this one only decides which attempt that should be.
+ */
+ private boolean hasUnusableIvmStream() {
+ Database mvDb = (Database) mtmv.getDatabase();
+ if (mvDb == null) {
+ // Nothing to look the streams up in, so there is nothing to
decide here.
+ return false;
+ }
+ Set<TableNameInfo> excluded = mtmv.getExcludedTriggerTables();
+ for (BaseTableInfo baseTableInfo : relation.getBaseTables()) {
Review Comment:
**[P2] Limit the preflight to streams this MV actually scans**
`relation.getBaseTables()` is the transitive dependency closure: for a
supported chained IVM `l2 AS SELECT ... FROM l1`, it also contains `l1`'s
ancestor tables. Both `IvmDeltaRewriter` and `IvmFullRefreshMTMV` obtain
streams only from the actual `LogicalOlapScan` leaves, so l2's stream for that
grandparent is unused. If only that over-provisioned stream is dropped or
stale, this loop returns true and replaces a viable incremental/partition
fallback with COMPLETE, turning a small refresh into an unnecessary full
rebuild (or a resource failure). Please derive this check from the normalized
plan's scan leaves, or at least use `getBaseTablesOneLevelAndFromView()`, and
cover the chained-IVM case.
--
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]