This is an automated email from the ASF dual-hosted git repository. yiguolei pushed a commit to branch branch-2.1 in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.1 by this push: new 997db43dda0 branch-2.1: [improve](thrift) Config thrift_max_message_size for THREAD_POOL and … #49677 (#49724) 997db43dda0 is described below commit 997db43dda05bb899311e76f74d073dea226d323 Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> AuthorDate: Tue Apr 1 17:16:58 2025 +0800 branch-2.1: [improve](thrift) Config thrift_max_message_size for THREAD_POOL and … #49677 (#49724) Cherry-picked from #49677 Co-authored-by: walter <maoch...@selectdb.com> --- be/src/util/thrift_server.cpp | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/be/src/util/thrift_server.cpp b/be/src/util/thrift_server.cpp index 84173300bd1..fc40ac7b878 100644 --- a/be/src/util/thrift_server.cpp +++ b/be/src/util/thrift_server.cpp @@ -82,6 +82,25 @@ private: std::shared_ptr<TConfiguration> config; }; +class ImprovedBufferedTransportFactory + : public apache::thrift::transport::TBufferedTransportFactory { + using TConfiguration = apache::thrift::TConfiguration; + using TTransport = apache::thrift::transport::TTransport; + using TBufferedTransport = apache::thrift::transport::TBufferedTransport; + +public: + ImprovedBufferedTransportFactory() + : config(std::make_shared<TConfiguration>(config::thrift_max_message_size)) {} + ~ImprovedBufferedTransportFactory() override = default; + + std::shared_ptr<TTransport> getTransport(std::shared_ptr<TTransport> trans) override { + return std::make_shared<TBufferedTransport>(std::move(trans), config); + } + +private: + std::shared_ptr<TConfiguration> config; +}; + // Helper class that starts a server in a separate thread, and handles // the inter-thread communication to monitor whether it started // correctly. @@ -337,8 +356,7 @@ Status ThriftServer::start() { std::make_shared<apache::thrift::concurrency::ThreadFactory>(); std::shared_ptr<apache::thrift::transport::TServerTransport> fe_server_transport; std::shared_ptr<apache::thrift::transport::TTransportFactory> transport_factory; - std::shared_ptr<apache::thrift::transport::TNonblockingServerSocket> socket = - std::make_shared<ImprovedNonblockingServerSocket>(_port); + std::shared_ptr<apache::thrift::transport::TNonblockingServerSocket> socket; if (_server_type != THREADED) { thread_mgr = apache::thrift::concurrency::ThreadManager::newSimpleThreadManager( _num_worker_threads); @@ -352,6 +370,7 @@ Status ThriftServer::start() { switch (_server_type) { case NON_BLOCKING: + socket = std::make_shared<ImprovedNonblockingServerSocket>(_port); if (transport_factory == nullptr) { transport_factory.reset(new apache::thrift::transport::TTransportFactory()); } @@ -366,7 +385,7 @@ Status ThriftServer::start() { BackendOptions::get_service_bind_address_without_bracket(), _port)); if (transport_factory == nullptr) { - transport_factory.reset(new apache::thrift::transport::TBufferedTransportFactory()); + transport_factory = std::make_shared<ImprovedBufferedTransportFactory>(); } _server = std::make_unique<apache::thrift::server::TThreadPoolServer>( @@ -380,7 +399,7 @@ Status ThriftServer::start() { server_socket->setKeepAlive(true); if (transport_factory == nullptr) { - transport_factory.reset(new apache::thrift::transport::TBufferedTransportFactory()); + transport_factory = std::make_shared<ImprovedBufferedTransportFactory>(); } _server = std::make_unique<apache::thrift::server::TThreadedServer>( --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org