arbitration_mode support authentication and adjust default net thread count

This commit is contained in:
liucc1997 2023-07-13 06:48:09 +00:00 committed by ob-robot
parent 075115e5dc
commit f109493977
4 changed files with 20 additions and 29 deletions

View File

@ -37,7 +37,7 @@ int get_server_auth_methods()
void set_client_auth_methods(const int methods)
{
g_ussl_client_auth_methods = methods;
ATOMIC_STORE(&g_ussl_client_auth_methods, methods);
}
int get_client_auth_methods()

View File

@ -69,25 +69,6 @@ static bool enable_new_sql_nio()
return GCONF._enable_new_sql_nio;
}
static int get_default_net_thread_count()
{
int cnt = 1;
int cpu_num = get_cpu_num();
if (cpu_num <= 4) {
cnt = 1;
} else if (cpu_num <= 8) {
cnt = 2;
} else if (cpu_num <= 16) {
cnt = 4;
} else if (cpu_num <= 32) {
cnt = 7;
} else {
cnt = max(8, get_cpu_num() / 6);
}
return cnt;
}
static int update_tcp_keepalive_parameters_for_sql_nio_server(int tcp_keepalive_enabled, int64_t tcp_keepidle, int64_t tcp_keepintvl, int64_t tcp_keepcnt)
{
int ret = OB_SUCCESS;

View File

@ -120,18 +120,18 @@ ObSrvNetworkFrame::get_xlator() {
static int get_default_net_thread_count()
{
int cnt = 1;
int cpu_num = static_cast<int>(get_cpu_num());
int cpu_num = static_cast<int>(get_cpu_count());
if (cpu_num <= 4) {
cnt = 2;
cnt = 1;
} else if (cpu_num <= 8) {
cnt = 3;
cnt = 2;
} else if (cpu_num <= 16) {
cnt = 5;
cnt = 4;
} else if (cpu_num <= 32) {
cnt = 7;
} else {
cnt = max(8, static_cast<int>(get_cpu_num()) / 6);
cnt = max(8, cpu_num / 6);
}
return cnt;
}

View File

@ -28,6 +28,10 @@
#include "observer/omt/ob_tenant_config_mgr.h"
#include "share/ob_rpc_struct.h"
#include "observer/ob_server_struct.h"
extern "C" {
#include "ussl-hook.h"
#include "auth-methods.h"
}
namespace oceanbase
{
namespace common
@ -415,15 +419,21 @@ OB_DEF_SERIALIZE_SIZE(ObServerConfig)
} // end of namespace common
namespace obrpc {
bool enable_pkt_nio() {
return GCONF._enable_pkt_nio
&& (!OBSERVER.is_arbitration_mode())
&& GET_MIN_CLUSTER_VERSION() >= CLUSTER_VERSION_4_2_0_0;
bool bool_ret = false;
if (OB_UNLIKELY(OBSERVER.is_arbitration_mode())) {
bool enable_clent_auth = (get_client_auth_methods() != USSL_AUTH_NONE);
bool_ret = GCONF._enable_pkt_nio && enable_clent_auth;
} else {
bool_ret = GCONF._enable_pkt_nio && GET_MIN_CLUSTER_VERSION() >= CLUSTER_VERSION_4_2_0_0;
}
return bool_ret;
}
int64_t get_max_rpc_packet_size()
{
return GCONF._max_rpc_packet_size;
}
}
} // end of namespace obrpc
} // end of namespace oceanbase
namespace easy