-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[Chore](query) add _query_ctx_map_delay_delete (#59262) (#56911) #59638
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This pull request introduces a delayed deletion mechanism for `QueryContext` objects in the fragment manager to ensure that runtime filter merging works correctly after a query reaches its end-of-stream (EOS). The main changes involve adding a new map to retain query contexts temporarily, modifying the lifecycle management of query contexts, and introducing utility methods to support this behavior. **Query Context Lifecycle Management:** * Added a new member `_query_ctx_map_delay_delete` to `FragmentMgr` to keep `QueryContext` objects alive for a short period after query EOS, ensuring that the runtime filter coordinator can complete its work. * Modified `FragmentMgr::remove_query_context` to erase entries from `_query_ctx_map_delay_delete` as part of the cleanup process. * Updated the `QueryContext` destructor to call `remove_query_context` only if the fragment manager is available, preventing issues during unit tests. **Runtime Filter Merge Coordination:** * In `FragmentMgr::_get_or_create_query_ctx`, now inserts the `QueryContext` into `_query_ctx_map_delay_delete` if the runtime filter merge handler is not empty, ensuring the context is retained for merging. * Added an `empty()` method to `RuntimeFilterMergeControllerEntity` to check if the filter map is empty, which is used to determine if delayed deletion is needed.
Contributor
Author
|
run buildall |
Contributor
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
Now query contexts will not be removed from the FragmentMgr eagerly which may lead to a very large map to hold all query contexts.
Contributor
Author
|
run buildall |
Contributor
BE UT Coverage ReportIncrement line coverage Increment coverage report
|
Contributor
|
skip buildall |
yiguolei
approved these changes
Jan 12, 2026
Contributor
|
PR approved by at least one committer and no changes requested. |
Contributor
|
PR approved by anyone and no changes requested. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request introduces a delayed deletion mechanism for
QueryContextobjects in the fragment manager to ensure that runtime filter merging works correctly after a query reaches its end-of-stream (EOS). The main changes involve adding a new map to retain query contexts temporarily, modifying the lifecycle management of query contexts, and introducing utility methods to support this behavior.Query Context Lifecycle Management:
_query_ctx_map_delay_deletetoFragmentMgrto keepQueryContextobjects alive for a short period after query EOS, ensuring that the runtime filter coordinator can complete its work.FragmentMgr::remove_query_contextto erase entries from_query_ctx_map_delay_deleteas part of the cleanup process.QueryContextdestructor to callremove_query_contextonly if the fragment manager is available, preventing issues during unit tests.Runtime Filter Merge Coordination:
FragmentMgr::_get_or_create_query_ctx, now inserts theQueryContextinto_query_ctx_map_delay_deleteif the runtime filter merge handler is not empty, ensuring the context is retained for merging.empty()method toRuntimeFilterMergeControllerEntityto check if the filter map is empty, which is used to determine if delayed deletion is needed.What problem does this PR solve?
Issue Number: close #xxx
Related PR: #xxx
Problem Summary:
Release note
None
Check List (For Author)
Test
Behavior changed:
Does this need documentation?
Check List (For Reviewer who merge this PR)