提交 f6b72d96 编写于 作者: G groot 提交者: Jin Hai

#977 Server crash when create tables concurrently (#991)

* #766 If partition tag is similar, wrong partition is searched

* #766 If partition tag is similar, wrong partition is searched

* reorder changelog id

* typo

* #977 Server crash when create tables concurrently
上级 a0a50764
......@@ -10,6 +10,7 @@ Please mark all change in change log and use the issue from GitHub
- \#770 - Server unittest run failed on low-end server
- \#805 - IVFTest.gpu_seal_test unittest failed
- \#831 - Judge branch error in CommonUtil.cpp
- \#977 - Server crash when create tables concurrently
## Feature
- \#216 - Add CLI to get server info
......
......@@ -114,27 +114,29 @@ GrpcRequestHandler::OnPostRecvInitialMetaData(
auto trace_context = std::make_shared<tracing::TraceContext>(span);
auto context = std::make_shared<Context>(request_id);
context->SetTraceContext(trace_context);
context_map_[server_rpc_info->server_context()] = context;
SetContext(server_rpc_info->server_context(), context);
}
void
GrpcRequestHandler::OnPreSendMessage(::grpc::experimental::ServerRpcInfo* server_rpc_info,
::grpc::experimental::InterceptorBatchMethods* interceptor_batch_methods) {
std::lock_guard<std::mutex> lock(context_map_mutex_);
context_map_[server_rpc_info->server_context()]->GetTraceContext()->GetSpan()->Finish();
auto search = context_map_.find(server_rpc_info->server_context());
if (search != context_map_.end()) {
std::lock_guard<std::mutex> lock(context_map_mutex_);
context_map_.erase(search);
}
}
const std::shared_ptr<Context>&
GrpcRequestHandler::GetContext(::grpc::ServerContext* server_context) {
std::lock_guard<std::mutex> lock(context_map_mutex_);
return context_map_[server_context];
}
void
GrpcRequestHandler::SetContext(::grpc::ServerContext* server_context, const std::shared_ptr<Context>& context) {
std::lock_guard<std::mutex> lock(context_map_mutex_);
context_map_[server_context] = context;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册