zclllyybb commented on issue #65654:
URL: https://github.com/apache/doris/issues/65654#issuecomment-4979482560

   Breakwater-GitHub-Analysis-Slot: slot_1e4f4948da0f
   This content is generated by AI for reference only.
   
   Initial analysis from the current `upstream/master` code path:
   
   This looks like a real FE/Nereids rewrite-loop bug in the stream-scan 
subclass contract, not an MTMV-only issue.
   
   The confirmed chain is:
   
   1. `PruneOlapScanPartition` matches only unpruned OLAP scans 
(`!scan.isPartitionPruned()`).
   2. After pruning, it calls `scan.withSelectedPartitionIds(prunedPartitions, 
hasPartitionPredicate)`.
   3. In the parent `LogicalOlapScan`, that second argument means 
`hasPartitionPredicate`, and the rebuilt scan is always created with 
`partitionPruned=true`.
   4. `LogicalOlapTableStreamScan` extends `LogicalOlapScan`, so it is eligible 
for the same pruning rule, but its override currently treats the same second 
argument as `isPartitionPruned` and passes it into the stream-scan constructor 
as the `partitionPruned` value.
   5. Therefore, when pruning succeeds but `hasPartitionPredicate=false`, the 
rebuilt `LogicalOlapTableStreamScan` still has `partitionPruned=false`. The 
pruning rule can keep matching the same logical shape and repeatedly rebuild 
the plan.
   
   That matches the reported symptoms: repeated `PruneOlapScanPartition`, 
`TopDownVisitorRewriteJob` revisiting the same subtree, task remaining 
`RUNNING`, and FE CPU/allocation pressure.
   
   I also found the linked public fix PR: #65657. Its diff aligns with the 
code-level diagnosis: keep the boolean parameter as `hasPartitionPredicate` and 
pass `true` for the rebuilt stream scan's `partitionPruned` flag. That is the 
right fix direction for this specific loop.
   
   Suggested next steps:
   
   - Review and merge #65657 after CI/review passes.
   - Keep the regression evidence visible. The PR states 
`./run-regression-test.sh --run -d mtmv_p0 -s test_ivm_partition_unique_key` 
was run manually; if possible, attach/keep that result or add a deterministic 
regression assertion so this does not regress silently.
   - Check whether any maintained release branch already contains 
`LogicalOlapTableStreamScan` and the same override. If yes, it should receive 
the same fix because the bug is in a generic builder contract used by the 
optimizer.
   
   Missing information is not blocking the root-cause assessment, because the 
current master code already shows the contract mismatch. For impact 
scoping/backport decisions, the useful extra data would be the exact commit SHA 
of the reproduced development branch and, if available, one FE stack sample 
from the hanging task showing the repeated pruning rewrite.
   


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