You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by mo...@apache.org on 2020/11/22 12:40:45 UTC

[incubator-doris] branch master updated: [Bug] fix bug that be thrift client cannot connect to fe thrift server when fe thrift server use `TThreadedSelectorServer` model (#4908)

This is an automated email from the ASF dual-hosted git repository.

morningman pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-doris.git


The following commit(s) were added to refs/heads/master by this push:
     new fb7f4c8  [Bug] fix bug that be thrift client cannot connect to fe thrift server when fe thrift server use `TThreadedSelectorServer` model (#4908)
fb7f4c8 is described below

commit fb7f4c87911c48964bd38764c8e048333dd8fe80
Author: caiconghui <55...@users.noreply.github.com>
AuthorDate: Sun Nov 22 20:40:33 2020 +0800

    [Bug] fix bug that be thrift client cannot connect to fe thrift server when fe thrift server use `TThreadedSelectorServer` model (#4908)
    
    Fix bug that be thrift client cannot connect to fe thrift server when fe thrift server use TThreadedSelectorServer model
---
 be/src/common/config.h                             |  4 ++++
 be/src/runtime/client_cache.h                      | 13 ++++++++++++-
 be/src/util/thrift_client.h                        |  7 +------
 docs/en/administrator-guide/config/be_config.md    |  8 ++++++++
 docs/zh-CN/administrator-guide/config/be_config.md |  8 ++++++++
 5 files changed, 33 insertions(+), 7 deletions(-)

diff --git a/be/src/common/config.h b/be/src/common/config.h
index f277326..401088d 100644
--- a/be/src/common/config.h
+++ b/be/src/common/config.h
@@ -603,6 +603,10 @@ namespace config {
     // the load process will reject new incoming load job of this tablet.
     // This is to avoid too many version num.
     CONF_mInt32(max_tablet_version_num, "500");
+
+    // Frontend mainly use two thrift sever type: THREAD_POOL, THREADED. if fe use THREADED model for thrift server,
+    // the thrift_server_type_of_fe should be set THREADED to make be thrift client to fe constructed with TFramedTransport
+    CONF_String(thrift_server_type_of_fe, "THREAD_POOL");
     
 } // namespace config
 
diff --git a/be/src/runtime/client_cache.h b/be/src/runtime/client_cache.h
index fbcaede..69a51ec 100644
--- a/be/src/runtime/client_cache.h
+++ b/be/src/runtime/client_cache.h
@@ -270,11 +270,22 @@ private:
 
     // Factory method to produce a new ThriftClient<T> for the wrapped cache
     ThriftClientImpl* make_client(const TNetworkAddress& hostport, void** client_key) {
-        Client* client = new Client(hostport.hostname, hostport.port);
+        static ThriftServer::ServerType server_type = get_thrift_server_type();
+        Client* client = new Client(hostport.hostname, hostport.port, server_type);
         *client_key = reinterpret_cast<void*>(client->iface());
         return client;
     }
 
+    // since service type is multiple, we should set thrift server type here for be thrift client
+    ThriftServer::ServerType get_thrift_server_type() {
+        auto &thrift_server_type = config::thrift_server_type_of_fe;
+        transform(thrift_server_type.begin(), thrift_server_type.end(), thrift_server_type.begin(), toupper);
+        if (strcmp(typeid(T).name(), "N5doris21FrontendServiceClientE") == 0 && thrift_server_type == "THREADED") {
+            return ThriftServer::ServerType::THREADED;
+        } else {
+            return ThriftServer::ServerType::THREAD_POOL;
+        }
+    }
 };
 
 // Doris backend client cache, used by a backend to send requests
diff --git a/be/src/util/thrift_client.h b/be/src/util/thrift_client.h
index fbee380..69b729e 100644
--- a/be/src/util/thrift_client.h
+++ b/be/src/util/thrift_client.h
@@ -139,17 +139,12 @@ ThriftClient<InterfaceType>::ThriftClient(
             _iface(new InterfaceType(_protocol)) {
     switch (server_type) {
     case ThriftServer::NON_BLOCKING:
-        // The Nonblocking server is disabled at this time.  There are
-        // issues with the framed protocol throwing negative frame size errors.
-        LOG(WARNING) << "Nonblocking server usage is experimental";
+    case ThriftServer::THREADED:
         _transport.reset(new apache::thrift::transport::TFramedTransport(_socket));
         break;
-
     case ThriftServer::THREAD_POOL:
-    case ThriftServer::THREADED:
         _transport.reset(new apache::thrift::transport::TBufferedTransport(_socket));
         break;
-
     default:
         std::stringstream error_msg;
         error_msg << "Unsupported server type: " << server_type;
diff --git a/docs/en/administrator-guide/config/be_config.md b/docs/en/administrator-guide/config/be_config.md
index eafd6b0..dcca0c6 100644
--- a/docs/en/administrator-guide/config/be_config.md
+++ b/docs/en/administrator-guide/config/be_config.md
@@ -794,6 +794,14 @@ If the system is found to be in a high-stress scenario and a large number of thr
 
 ### `thrift_rpc_timeout_ms`
 
+### `thrift_server_type_of_fe`
+
+This configuration indicates the service model used by FE's Thrift service. The type is string and is case-insensitive. This parameter needs to be consistent with the setting of fe's thrift_server_type parameter. Currently there are two values for this parameter, `THREADED` and `THREAD_POOL`.
+
+If the parameter is `THREADED`, the model is a non-blocking I/O model,
+
+If the parameter is `THREAD_POOL`, the model is a blocking I/O model.
+
 ### `trash_file_expire_time_sec`
 
 ### `txn_commit_rpc_timeout_ms`
diff --git a/docs/zh-CN/administrator-guide/config/be_config.md b/docs/zh-CN/administrator-guide/config/be_config.md
index c761545..ad54636 100644
--- a/docs/zh-CN/administrator-guide/config/be_config.md
+++ b/docs/zh-CN/administrator-guide/config/be_config.md
@@ -791,6 +791,14 @@ Stream Load 一般适用于导入几个GB以内的数据,不适合导入过大
 
 ### `thrift_rpc_timeout_ms`
 
+### `thrift_server_type_of_fe`
+
+该配置表示FE的Thrift服务使用的服务模型, 类型为string, 大小写不敏感,该参数需要和fe的thrift_server_type参数的设置保持一致。目前该参数的取值有两个,`THREADED`和`THREAD_POOL`。
+
+若该参数为`THREADED`, 该模型为非阻塞式I/O模型,
+
+若该参数为`THREAD_POOL`, 该模型为阻塞式I/O模型。
+
 ### `trash_file_expire_time_sec`
 
 ### `txn_commit_rpc_timeout_ms`


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org