Skip to content

Commit

Permalink
stable async setting (#4485)
Browse files Browse the repository at this point in the history
close #4424
  • Loading branch information
bestwoody authored Mar 30, 2022
1 parent 237b3e3 commit 01f5116
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
6 changes: 5 additions & 1 deletion dbms/src/Flash/FlashService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ FlashService::FlashService(IServer & server_)
, log(&Poco::Logger::get("FlashService"))
{
auto settings = server_.context().getSettingsRef();
enable_local_tunnel = settings.enable_local_tunnel;
enable_async_grpc_client = settings.enable_async_grpc_client;
const size_t default_size = 2 * getNumberOfPhysicalCPUCores();

size_t cop_pool_size = static_cast<size_t>(settings.cop_pool_size);
Expand Down Expand Up @@ -448,7 +450,9 @@ std::tuple<ContextPtr, grpc::Status> FlashService::createDBContext(const grpc::S
{
context->setSetting("dag_records_per_chunk", dag_records_per_chunk_str);
}

context->setSetting("enable_async_server", is_async ? "true" : "false");
context->setSetting("enable_local_tunnel", enable_local_tunnel ? "true" : "false");
context->setSetting("enable_async_grpc_client", enable_async_grpc_client ? "true" : "false");
return std::make_tuple(context, grpc::Status::OK);
}
catch (Exception & e)
Expand Down
4 changes: 4 additions & 0 deletions dbms/src/Flash/FlashService.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ class FlashService : public tikvpb::Tikv::Service
IServer & server;
const TiFlashSecurityConfig & security_config;
Poco::Logger * log;
bool is_async = false;
bool enable_local_tunnel = false;
bool enable_async_grpc_client = false;

// Put thread pool member(s) at the end so that ensure it will be destroyed firstly.
std::unique_ptr<ThreadPool> cop_pool, batch_cop_pool;
Expand All @@ -97,6 +100,7 @@ class AsyncFlashService final : public FlashService
explicit AsyncFlashService(IServer & server)
: FlashService(server)
{
is_async = true;
::grpc::Service::MarkMethodAsync(EstablishMPPConnectionApiID);
}

Expand Down

0 comments on commit 01f5116

Please sign in to comment.