mrhhsg opened a new pull request, #71329:
URL: https://github.com/apache/doris/pull/71329

   ### What problem does this PR solve?
   
   Issue Number: None
   
   Related PR: #71289
   
   Cherry-picked from #71289 to `branch-4.1`.
   
   `RuntimeFilterMergeControllerEntity::merge()` released 
`GlobalMergeContext::mtx` before publishing the merged runtime filter. A 
concurrent recursive CTE round reset can replace the merger and clear the 
publication state under the same lock. This can invalidate the borrowed Bloom 
filter buffer between serialization and copying, or mix readiness and 
publication state from different rounds.
   
   ### Changes
   
   - Keep the readiness check and `_send_rf_to_target()` inside the existing 
merge-context critical section, protecting serialization, the attachment copy, 
publication state, and asynchronous RPC submission against round reset.
   - Preserve the existing `branch-4.1` stale-stage and null-merger checks, 
error handling, and direct/tree publication paths. RPC completion is not 
awaited under this lock.
   - Add the complete recursive CTE regression fixture and expected output, 
which are absent from `branch-4.1`. The coverage checks cross-Exchange 
runtime-filter publication and explicitly exercises Bloom filters.
   
   ### Release note
   
   Prevent runtime-filter publication from racing with recursive CTE round 
resets.
   
   ### Testing
   
   Local validation of the final code tree:
   
   - `BUILD_TYPE=ASAN FE_MAVEN_THREADS=8 ./build.sh --be --fe -j 48`: passed, 
including Maven Checkstyle (zero violations).
   - `./run-be-ut.sh --run --filter='RuntimeFilterMgrTest.*' -j 48`: 5/5 passed.
   - Recursive CTE regression (`-d recursive_cte -s rf_merge_context_reuse 
-parallel 1 -times 3`): 3/3 runs passed.
   - Existing runtime-filter regressions (`-d 
nereids_p0/runtime_filter,query_p0/runtimefilterV2 -parallel 1`): 6/6 suites 
passed; no failures or skips.
   - `clang-format --dry-run --Werror 
be/src/exec/runtime_filter/runtime_filter_mgr.cpp` (clang-format 16): passed.
   - `git diff --check`: passed for the complete backport diff.
   - Post-shutdown BE log scan found no ASAN/UBSAN/LSAN error signatures.
   
   Both regression selections used `./run-regression-test.sh --run` with an 
isolated local configuration and one ASAN-enabled BE. Multi-BE stress, 
deterministic race reproduction, and performance testing were not run.
   
   ### Check List (For Author)
   
   - Test:
       - [x] Regression test
       - [x] Unit Test
   - Behavior changed:
       - [x] Yes. Runtime-filter publication is synchronized with recursive CTE 
round reset; SQL semantics and the wire format are unchanged.
   - Does this need documentation?
       - [x] No.


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