github-actions[bot] commented on code in PR #63639:
URL: https://github.com/apache/doris/pull/63639#discussion_r4272521191
##########
fe/fe-core/src/main/java/org/apache/doris/catalog/MTMV.java:
##########
@@ -672,23 +674,24 @@ public MTMVCache getOrGenerateCache(ConnectContext
connectionContext) throws
// Someone invalidated between our snapshot and now; drop
the stale build and retry.
continue;
}
+ MTMVCache published =
cacheWithValidOutputPredicates(generated);
if (manager.isEnabled()) {
MTMVCache existing = manager.getIfPresent(this.id,
guarded);
if (existing != null) {
return existing;
}
if (!isDropped) {
- manager.put(this.id, guarded, generated);
+ manager.put(this.id, guarded, published);
}
} else if (statementContext != null && !isDropped) {
// Global cache is disabled (maximumSize=0); keep one copy
for this statement only.
MTMVCache existing =
statementContext.getQueryLocalMtmvCache(this.id, guarded);
if (existing != null) {
return existing;
}
- statementContext.putQueryLocalMtmvCache(this.id, guarded,
generated);
+ statementContext.putQueryLocalMtmvCache(this.id, guarded,
published);
Review Comment:
[P1] Version the statement-local output guarantees across retries. With
mtmv_cache_manage_num=0, these predicates are stored in StatementContext
without rewriteCacheGeneration, and the earlier lookup returns them even after
invalidateRewriteCache(). InsertIntoTableCommand.initPlan reuses that context
after a destination-schema retry, while NereidsPlanner releases table locks
between attempts. For unpartitioned MVs, let lower initially store ids >10 and
upper be Project(id)->Filter(id>10)->Scan(lower). After the first INSERT ...
SELECT id FROM lower plan, loosen lower's native base view to id>0 and refresh
lower and then upper before retrying. Lower now has ids1..20 and the fresh
upper only11..20, but the old local lower guarantee still says id>10:
withoutRedundantMvFilters removes upper's real filter and can rewrite the bare
lower source to upper, losing ids1..10. Freshness checks do not reject the
freshly refreshed upper. Validate local entries against the current generation,
or
clear them for each planning attempt.
--
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]