Skip to content

Commit

Permalink
[improvement](fragment) optimize to get query context logic (apache#2…
Browse files Browse the repository at this point in the history
  • Loading branch information
sollhui authored Oct 25, 2023
1 parent a979d5a commit 235ae9d
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions be/src/runtime/fragment_mgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 235ae9d

Please sign in to comment.