[improvement](fragment) optimize to get query context logic (#25621)

This commit is contained in:
HHoflittlefish777
2023-10-25 14:03:47 +08:00
committed by GitHub
parent a979d5a1f0
commit 235ae9ded4

View File

@ -584,6 +584,17 @@ Status FragmentMgr::_get_query_ctx(const Params& params, TUniqueId query_id, boo
}
query_ctx = search->second;
} else {
{
// Find _query_ctx_map, in case some other request has already
// create the query fragments context.
std::lock_guard<std::mutex> lock(_lock);
auto search = _query_ctx_map.find(query_id);
if (search != _query_ctx_map.end()) {
query_ctx = search->second;
return Status::OK();
}
}
// This may be a first fragment request of the query.
// Create the query fragments context.
query_ctx = QueryContext::create_shared(query_id, params.fragment_num_on_host, _exec_env,