|
64 | 64 | #include "io/fs/stream_load_pipe.h" |
65 | 65 | #include "pipeline/pipeline_fragment_context.h" |
66 | 66 | #include "runtime/client_cache.h" |
| 67 | +#include "runtime/coordinator_context.h" |
67 | 68 | #include "runtime/descriptors.h" |
68 | 69 | #include "runtime/exec_env.h" |
69 | 70 | #include "runtime/frontend_info.h" |
70 | 71 | #include "runtime/primitive_type.h" |
71 | 72 | #include "runtime/query_context.h" |
72 | | -#include "runtime/query_handle.h" |
73 | 73 | #include "runtime/runtime_query_statistics_mgr.h" |
74 | 74 | #include "runtime/runtime_state.h" |
75 | 75 | #include "runtime/stream_load/new_load_stream_mgr.h" |
@@ -728,10 +728,10 @@ Status FragmentMgr::_get_or_create_query_ctx(const TPipelineFragmentParams& para |
728 | 728 | query_ctx = QueryContext::create(query_id, _exec_env, params.query_options, |
729 | 729 | params.coord, params.is_nereids, |
730 | 730 | params.current_connect_fe, query_source); |
731 | | - auto query_handle = std::make_shared<QueryHandle>( |
| 731 | + auto coordinator_context = std::make_shared<CoordinatorContext>( |
732 | 732 | query_id, parent.query_options, query_ctx); |
733 | | - _query_handle_map.insert(query_id, query_handle); |
734 | | - query_ctx->set_query_handle(query_handle); |
| 733 | + _coordinator_context_map.insert(query_id, coordinator_context); |
| 734 | + query_ctx->set_coordinator_context(coordinator_context); |
735 | 735 | SCOPED_SWITCH_THREAD_MEM_TRACKER_LIMITER(query_ctx->query_mem_tracker()); |
736 | 736 | RETURN_IF_ERROR(DescriptorTbl::create( |
737 | 737 | &(query_ctx->obj_pool), params.desc_tbl, &(query_ctx->desc_tbl))); |
@@ -760,7 +760,7 @@ Status FragmentMgr::_get_or_create_query_ctx(const TPipelineFragmentParams& para |
760 | 760 | auto handler = |
761 | 761 | std::make_shared<RuntimeFilterMergeControllerEntity>(); |
762 | 762 | RETURN_IF_ERROR(handler->init(info.runtime_filter_params)); |
763 | | - query_handle->set_merge_controller_handler(handler); |
| 763 | + coordinator_context->set_merge_controller_handler(handler); |
764 | 764 |
|
765 | 765 | query_ctx->runtime_filter_mgr()->set_runtime_filter_params( |
766 | 766 | info.runtime_filter_params); |
@@ -790,10 +790,11 @@ std::string FragmentMgr::dump_pipeline_tasks(int64_t duration) { |
790 | 790 | timespec now; |
791 | 791 | clock_gettime(CLOCK_MONOTONIC, &now); |
792 | 792 |
|
793 | | - _query_handle_map.apply( |
794 | | - [&](phmap::flat_hash_map<TUniqueId, std::shared_ptr<QueryHandle>>& map) -> Status { |
| 793 | + _coordinator_context_map.apply( |
| 794 | + [&](phmap::flat_hash_map<TUniqueId, std::shared_ptr<CoordinatorContext>>& map) |
| 795 | + -> Status { |
795 | 796 | for (auto& it : map) { |
796 | | - fmt::format_to(debug_string_buffer, "QueryHandle: {}\n", |
| 797 | + fmt::format_to(debug_string_buffer, "CoordinatorContext: {}\n", |
797 | 798 | it.second->debug_string()); |
798 | 799 | } |
799 | 800 | return Status::OK(); |
@@ -920,7 +921,7 @@ void FragmentMgr::cancel_query(const TUniqueId query_id, const Status reason) { |
920 | 921 | SCOPED_ATTACH_TASK(query_ctx->resource_ctx()); |
921 | 922 | query_ctx->cancel(reason); |
922 | 923 | remove_query_context(query_id); |
923 | | - _query_handle_map.erase(query_id); |
| 924 | + _coordinator_context_map.erase(query_id); |
924 | 925 | LOG(INFO) << "Query " << print_id(query_id) |
925 | 926 | << " is cancelled and removed. Reason: " << reason.to_string(); |
926 | 927 | } |
@@ -1317,7 +1318,7 @@ Status FragmentMgr::send_filter_size(const PSendFilterSizeRequest* request) { |
1317 | 1318 | return Status::EndOfFile("inject FragmentMgr::send_filter_size.return_eof"); |
1318 | 1319 | } |
1319 | 1320 |
|
1320 | | - if (auto q_handle = _query_handle_map.find(query_id); q_handle != nullptr) { |
| 1321 | + if (auto q_handle = _coordinator_context_map.find(query_id); q_handle != nullptr) { |
1321 | 1322 | return q_handle->get_merge_controller_handler()->send_filter_size(q_handle, request); |
1322 | 1323 | } else { |
1323 | 1324 | return Status::EndOfFile( |
@@ -1354,7 +1355,7 @@ Status FragmentMgr::merge_filter(const PMergeFilterRequest* request, |
1354 | 1355 | TUniqueId query_id; |
1355 | 1356 | query_id.__set_hi(queryid.hi); |
1356 | 1357 | query_id.__set_lo(queryid.lo); |
1357 | | - if (auto q_handle = _query_handle_map.find(query_id); q_handle != nullptr) { |
| 1358 | + if (auto q_handle = _coordinator_context_map.find(query_id); q_handle != nullptr) { |
1358 | 1359 | SCOPED_ATTACH_TASK(q_handle->resource_ctx()); |
1359 | 1360 | if (!q_handle->get_merge_controller_handler()) { |
1360 | 1361 | return Status::InternalError("Merge filter failed: Merge controller handler is null"); |
|
0 commit comments