mrhhsg opened a new pull request, #70305: URL: https://github.com/apache/doris/pull/70305
### Background A backend retains an extra QueryContext reference while coordinating merged runtime filters. Destruction of that context triggers the backend's final fragment-profile report. ### What problem does this PR solve? Issue Number: None Related PR: None PR Type: Bugfix Problem Summary: A successful query could retain the extra merge owner until cancellation or timeout, delaying its final profiles beyond the frontend's normal collection window. This change releases that owner after an eligible query has completed initial fragment preparation and all required remote filter dispatches and callbacks. Recursive, legacy, and duplicate-endpoint-start plans retain the conservative lifetime behavior. ### Details - **Change map:** Seven production/interface files (+215/-16 lines) cover BE completion and ownership, FE eligibility, and an optional Thrift field. Seven test and expected-output files (+424/-2 lines) cover lifecycle, failure, planning, profile, and recursive cases. - **Frequency:** The delayed owner can persist after successful queries with an RF merge controller; a local-only filter can also establish that owner without any remote merge work. - **Root cause:** Normal completion had no cleanup path for the delayed owner. The existing merge-done flag precedes remote RPC dispatch and cannot prove callback completion. - **Why existing tests missed it:** They did not check post-completion ownership or timely final profiles, nor the duplicate-start case where distinct workers share a BE endpoint. - **Fix:** Track required size and publish dispatches, callback completion, and failure per merge round. Sweep completed single-use contexts and release the extra owner outside map locks, after the whole initial fragment batch is prepared. Keep old-round completion alive across reset and accept a normal size-sync EOF. FE enables this only for complete, non-recursive plans with one worker identity per BRPC endpoint. - **Other paths and branches:** A missing or false optional field preserves the previous lifetime. Recursive and duplicate-endpoint-start plans do not opt in. No release branch is changed; mixed-version execution has not been run locally. ### Testing - `BUILD_TYPE=ASAN ./build.sh --be --fe -j 50` passed locally, including FE Checkstyle. - Focused `./run-fe-ut.sh --run` suites passed (27/27); focused ASAN `./run-be-ut.sh --run` tests passed (6/6). - Single-BE `rf_merge_context_profile`, `rf_merge_context_reuse`, and `rec_cte_parallel_targets` regression suites each passed (1 suite, 0 failed). - `build-support/clang-format.sh`, `build-support/check-format.sh`, `build-support/check-build-hygiene.sh`, `build-support/run-clang-tidy.sh`, and `git diff --check` passed locally. - Multi-BE late-filter, controlled delayed duplicate-start, and mixed-version execution were not run locally. ### Notes for Reviewers The optional FE-to-BE field is fail-closed. The BE requires complete initial deployment, successful remote phases, and zero pending callbacks before releasing the delayed owner; live fragment contexts still retain their own QueryContext references. ### Release note Final profiles for eligible successful queries using runtime filters can be reported promptly rather than waiting for query timeout. ### Check List (For Author) - Behavior changed: Yes (see Details) - Does this need documentation: No - Pre-submission status: Partially verified: local ASAN and single-BE validation passed; multi-BE and mixed-version execution were not run. ### AI Disclosure - Tool: OpenAI Codex - Generated: Code, tests, and this description. - Human review: No human review was performed on the generated changes. -- 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]
