You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by ga...@apache.org on 2024/10/15 10:39:59 UTC
(doris) branch branch-2.1 updated: [Improvement](minor) Reduce locking scope (#41845) (#41844)
This is an automated email from the ASF dual-hosted git repository.
gabriellee pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.1 by this push:
new b91d8e23273 [Improvement](minor) Reduce locking scope (#41845) (#41844)
b91d8e23273 is described below
commit b91d8e232739322e76d846a576995d9c09def3b6
Author: Gabriel <ga...@gmail.com>
AuthorDate: Tue Oct 15 18:39:53 2024 +0800
[Improvement](minor) Reduce locking scope (#41845) (#41844)
pick #41845
---
be/src/runtime/fragment_mgr.cpp | 26 +++++++++++++++-----------
1 file changed, 15 insertions(+), 11 deletions(-)
diff --git a/be/src/runtime/fragment_mgr.cpp b/be/src/runtime/fragment_mgr.cpp
index 4696814e55d..8473c885a8b 100644
--- a/be/src/runtime/fragment_mgr.cpp
+++ b/be/src/runtime/fragment_mgr.cpp
@@ -698,18 +698,22 @@ Status FragmentMgr::exec_plan_fragment(const TPipelineFragmentParams& params,
}
Status FragmentMgr::start_query_execution(const PExecPlanFragmentStartRequest* request) {
- std::lock_guard<std::mutex> lock(_lock);
- TUniqueId query_id;
- query_id.__set_hi(request->query_id().hi());
- query_id.__set_lo(request->query_id().lo());
- auto search = _query_ctx_map.find(query_id);
- if (search == _query_ctx_map.end()) {
- return Status::InternalError(
- "Failed to get query fragments context. Query may be "
- "timeout or be cancelled. host: {}",
- BackendOptions::get_localhost());
+ std::shared_ptr<QueryContext> q_ctx = nullptr;
+ {
+ std::lock_guard<std::mutex> lock(_lock);
+ TUniqueId query_id;
+ query_id.__set_hi(request->query_id().hi());
+ query_id.__set_lo(request->query_id().lo());
+ auto search = _query_ctx_map.find(query_id);
+ if (search == _query_ctx_map.end()) {
+ return Status::InternalError(
+ "Failed to get query fragments context. Query may be "
+ "timeout or be cancelled. host: {}",
+ BackendOptions::get_localhost());
+ }
+ q_ctx = search->second;
}
- search->second->set_ready_to_execute(false);
+ q_ctx->set_ready_to_execute(false);
return Status::OK();
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org