Sylwester Lachiewicz created THRIFT-6386:
--------------------------------------------
Summary: C++: add a builder that creates a TServer from a server
type and the usual settings
Key: THRIFT-6386
URL: https://issues.apache.org/jira/browse/THRIFT-6386
Project: Thrift
Issue Type: Improvement
Components: C++ - Library
Reporter: Sylwester Lachiewicz
Several C++ projects carry their own 450 to 530 line wrapper whose core picks a
Thrift server type and wires up the same pieces every time:
|| Project || File || Lines ||
| Apache Impala |
[be/src/rpc/thrift-server.cc|https://github.com/apache/impala/blob/master/be/src/rpc/thrift-server.cc]
| 462 |
| Apache Doris |
[be/src/util/thrift_server.cpp|https://github.com/apache/doris/blob/master/be/src/util/thrift_server.cpp]
| 529 |
| StarRocks |
[be/src/common/util/thrift_server.cpp|https://github.com/StarRocks/starrocks/blob/main/be/src/common/util/thrift_server.cpp]
| 448 |
The StarRocks file says it derives from the Doris one. Both select between
{{TNonblockingServer}}, {{TThreadPoolServer}} and {{TThreadedServer}}, create
the {{ThreadManager}} with {{ThreadManager::newSimpleThreadManager(n)}}, and
set a {{TBufferedTransportFactory}} and {{TBinaryProtocolFactory}}. The
non-blocking path also opens a {{TNonblockingServerSocket}}.
A small builder in lib/cpp that takes the server type, worker count, transport
and protocol factories and a {{TConfiguration}} would reduce these wrappers to
their project-specific parts (metrics, authentication, session tracking). It
would also let fixes to the servers' defaults, such as THRIFT-6183 and
THRIFT-6242 in 0.25.0, reach these projects without each of them re-reading its
copy.
Out of scope: SASL, which THRIFT-1620 covers.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)