yujun777 opened a new pull request, #70880: URL: https://github.com/apache/doris/pull/70880
### Background An incremental join combines a delta on each side with a snapshot on the opposite side. In Cloud mode, Meta Service returns the Stream consumption offset, end TSO, and partition visible version for the current batch. ### What problem does this PR solve? Issue Number: None Related PR: #62606 (introduced incremental join rewrite), #69850 (partition scan state) PR Type: Bugfix Problem Summary: A Cloud incremental refresh can permanently miss a join row when its post snapshot uses a stale FE partition version. A concurrent load can also place rows from after the current batch into the post snapshot. Reuse the batched Stream read state for the entire incremental join rewrite to keep these reads aligned. ### Details - **Change map:** 190 changed lines of FE code align branch selection and snapshot reads with the fixed Stream state and adapt the result to partition scan metadata. 209 lines of FE and SQL tests plus 19 generated output lines cover the boundary and the stale-cache reproducer. - **Frequency:** Intermittent. The local SQL case reliably triggers the stale-cache form by suppressing the importing FE's cache update for one insert. - **Root cause:** The delta rewriter chose pending branches before installing Stream state, then planned the post snapshot as a regular scan whose partition version was fetched separately. - **Why existing tests missed it:** Existing planner tests exercise windows and delta plan shape. Existing join SQL regressions use ordinary loads and do not hold the FE cache behind the Stream boundary. - **Fix:** Fetch one batch before choosing branches. Share it with pre snapshots, post snapshots, pruning, and consumption. Read post snapshots using fixed partition versions and a full base-table scan. The post snapshot uses its pinned versions for empty-partition pruning. - **Other paths and branches:** Both incremental MV models share the rewrite state and snapshot helper. The introducing commit is on master and branch-incremental-computation in the local upstream refs. - **Behavior change:** A Cloud incremental refresh reads the post snapshot at the corresponding Stream partition version. A stale FE version cache can no longer omit a match that belongs to that refresh. ### Testing On the original fix, the isolated Cloud comparison reproduced a missing join match on the unfixed FE. The fixed FE returned it on the first refresh, retained exactly one match on the second, and matched the full join. The full Cloud IVM directory passed 129 suites. The rebased FE build passed and the Cloud SQL reproducer passed before the final pruning adjustment. After restricting pinned-version pruning to the IVM post snapshot, the standard FE runner passed 78 focused tests and Checkstyle passed. ### Release note Cloud incremental join refreshes use a consistent version for each source partition and account for each matching row in the correct refresh. ### Check List (For Author) - Behavior changed: Yes (see Details) - Does this need documentation: No - Pre-submission status: Partially verified (Cloud SQL passed on the rebased FE before the final pruning adjustment) -- 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]
