From d3807b96ef186681763cf2e95a7172032280fe9d Mon Sep 17 00:00:00 2001 From: bestwoody <89765764+bestwoody@users.noreply.github.com> Date: Wed, 30 Mar 2022 15:22:29 +0800 Subject: [PATCH] stable async setting (#4485) close pingcap/tiflash#4424 --- dbms/src/Flash/FlashService.cpp | 6 +++++- dbms/src/Flash/FlashService.h | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/dbms/src/Flash/FlashService.cpp b/dbms/src/Flash/FlashService.cpp index 72d0654dd00..e40dbfc14da 100644 --- a/dbms/src/Flash/FlashService.cpp +++ b/dbms/src/Flash/FlashService.cpp @@ -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(settings.cop_pool_size); @@ -448,7 +450,9 @@ std::tuple 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) diff --git a/dbms/src/Flash/FlashService.h b/dbms/src/Flash/FlashService.h index e6dfbc46d2d..582259259ff 100644 --- a/dbms/src/Flash/FlashService.h +++ b/dbms/src/Flash/FlashService.h @@ -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 cop_pool, batch_cop_pool; @@ -97,6 +100,7 @@ class AsyncFlashService final : public FlashService explicit AsyncFlashService(IServer & server) : FlashService(server) { + is_async = true; ::grpc::Service::MarkMethodAsync(EstablishMPPConnectionApiID); }