Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stable async setting #4485

Merged
merged 7 commits into from
Mar 30, 2022
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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