arbitration_mode support authentication and adjust default net thread count
This commit is contained in:
2
deps/ussl-hook/loop/auth-methods.c
vendored
2
deps/ussl-hook/loop/auth-methods.c
vendored
@ -37,7 +37,7 @@ int get_server_auth_methods()
|
|||||||
|
|
||||||
void set_client_auth_methods(const int 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()
|
int get_client_auth_methods()
|
||||||
|
|||||||
@ -69,25 +69,6 @@ static bool enable_new_sql_nio()
|
|||||||
return GCONF._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)
|
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;
|
int ret = OB_SUCCESS;
|
||||||
|
|||||||
@ -120,18 +120,18 @@ ObSrvNetworkFrame::get_xlator() {
|
|||||||
static int get_default_net_thread_count()
|
static int get_default_net_thread_count()
|
||||||
{
|
{
|
||||||
int cnt = 1;
|
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) {
|
if (cpu_num <= 4) {
|
||||||
cnt = 2;
|
cnt = 1;
|
||||||
} else if (cpu_num <= 8) {
|
} else if (cpu_num <= 8) {
|
||||||
cnt = 3;
|
cnt = 2;
|
||||||
} else if (cpu_num <= 16) {
|
} else if (cpu_num <= 16) {
|
||||||
cnt = 5;
|
cnt = 4;
|
||||||
} else if (cpu_num <= 32) {
|
} else if (cpu_num <= 32) {
|
||||||
cnt = 7;
|
cnt = 7;
|
||||||
} else {
|
} else {
|
||||||
cnt = max(8, static_cast<int>(get_cpu_num()) / 6);
|
cnt = max(8, cpu_num / 6);
|
||||||
}
|
}
|
||||||
return cnt;
|
return cnt;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -28,6 +28,10 @@
|
|||||||
#include "observer/omt/ob_tenant_config_mgr.h"
|
#include "observer/omt/ob_tenant_config_mgr.h"
|
||||||
#include "share/ob_rpc_struct.h"
|
#include "share/ob_rpc_struct.h"
|
||||||
#include "observer/ob_server_struct.h"
|
#include "observer/ob_server_struct.h"
|
||||||
|
extern "C" {
|
||||||
|
#include "ussl-hook.h"
|
||||||
|
#include "auth-methods.h"
|
||||||
|
}
|
||||||
namespace oceanbase
|
namespace oceanbase
|
||||||
{
|
{
|
||||||
namespace common
|
namespace common
|
||||||
@ -415,15 +419,21 @@ OB_DEF_SERIALIZE_SIZE(ObServerConfig)
|
|||||||
} // end of namespace common
|
} // end of namespace common
|
||||||
namespace obrpc {
|
namespace obrpc {
|
||||||
bool enable_pkt_nio() {
|
bool enable_pkt_nio() {
|
||||||
return GCONF._enable_pkt_nio
|
bool bool_ret = false;
|
||||||
&& (!OBSERVER.is_arbitration_mode())
|
if (OB_UNLIKELY(OBSERVER.is_arbitration_mode())) {
|
||||||
&& GET_MIN_CLUSTER_VERSION() >= CLUSTER_VERSION_4_2_0_0;
|
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()
|
int64_t get_max_rpc_packet_size()
|
||||||
{
|
{
|
||||||
return GCONF._max_rpc_packet_size;
|
return GCONF._max_rpc_packet_size;
|
||||||
}
|
}
|
||||||
}
|
} // end of namespace obrpc
|
||||||
} // end of namespace oceanbase
|
} // end of namespace oceanbase
|
||||||
|
|
||||||
namespace easy
|
namespace easy
|
||||||
|
|||||||
Reference in New Issue
Block a user