#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
pull/1015/head^2
groot 2020-01-13 13:59:08 +08:00 committed by Jin Hai
parent a0a5076430
commit f6b72d9605
2 changed files with 5 additions and 2 deletions

View File

@ -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

View File

@ -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;
}