mirror of
https://gitee.com/wangbin579/cetus.git
synced 2024-11-30 02:47:35 +08:00
use reset conn instead of chang user when mysql > 5.7
This commit is contained in:
parent
9d2ba4e891
commit
5cf749ef0a
@ -703,7 +703,12 @@ static int admin_show_connectionlist(network_mysqld_con *admin_con, const char *
|
||||
g_ptr_array_add(row, g_strdup("0"));
|
||||
} else {
|
||||
g_ptr_array_add(row, g_strdup("Query"));
|
||||
int diff = (now.tv_sec - con->req_recv_time.tv_sec) * 1000;
|
||||
int diff = now.tv_sec - con->req_recv_time.tv_sec;
|
||||
if (diff > 7200) {
|
||||
g_critical("%s:too slow connection(%s) processing for con:%p",
|
||||
G_STRLOC, con->client->src->name->str, con);
|
||||
}
|
||||
diff = diff * 1000;
|
||||
diff += (now.tv_usec - con->req_recv_time.tv_usec) / 1000;
|
||||
snprintf(buffer, sizeof(buffer), "%d", diff);
|
||||
g_ptr_array_add(row, g_strdup(buffer));
|
||||
|
@ -1060,7 +1060,8 @@ process_quit_cmd(network_mysqld_con *con, int backend_ndx, int *disp_flag)
|
||||
if (con->is_in_transaction || network_mysqld_con_is_trx_feature_changed(con)) {
|
||||
g_message("%s: change user when COM_QUIT:%d", G_STRLOC, backend_ndx);
|
||||
int result;
|
||||
if (con->srv->is_reset_conn_enabled) {
|
||||
if (con->server->is_reset_conn_supported) {
|
||||
g_debug("%s: reset conn when COM_QUIT:%d", G_STRLOC, backend_ndx);
|
||||
result = reset_connection(con);
|
||||
} else {
|
||||
result = adjust_user(con);
|
||||
|
@ -139,7 +139,6 @@ struct chassis {
|
||||
unsigned int master_preferred;
|
||||
unsigned int is_reduce_conns;
|
||||
unsigned int xa_log_detailed;
|
||||
unsigned int is_reset_conn_enabled;
|
||||
unsigned int sharding_reload;
|
||||
unsigned int check_slave_delay;
|
||||
int complement_conn_cnt;
|
||||
|
@ -102,7 +102,6 @@ typedef struct {
|
||||
int is_client_compress_support;
|
||||
int check_slave_delay;
|
||||
int is_reduce_conns;
|
||||
int is_reset_conn_enabled;
|
||||
int long_query_time;
|
||||
int xa_log_detailed;
|
||||
int cetus_max_allowed_packet;
|
||||
@ -374,11 +373,6 @@ int chassis_frontend_set_chassis_options(chassis_frontend_t *frontend, chassis_o
|
||||
0, 0, OPTION_ARG_NONE, &(frontend->is_reduce_conns),
|
||||
"Reduce connections when idle connection num is too high", NULL);
|
||||
|
||||
chassis_options_add(opts,
|
||||
"enable-reset-connection",
|
||||
0, 0, OPTION_ARG_NONE, &(frontend->is_reset_conn_enabled),
|
||||
"Restart connections when feature changed", NULL);
|
||||
|
||||
chassis_options_add(opts,
|
||||
"enable-query-cache",
|
||||
0, 0, OPTION_ARG_NONE, &(frontend->query_cache_enabled),
|
||||
@ -516,7 +510,6 @@ static void init_parameters(chassis_frontend_t *frontend, chassis *srv)
|
||||
} else {
|
||||
g_message("%s:xa_log_detailed false", G_STRLOC);
|
||||
}
|
||||
srv->is_reset_conn_enabled = frontend->is_reset_conn_enabled;
|
||||
srv->query_cache_enabled = frontend->query_cache_enabled;
|
||||
if (srv->query_cache_enabled) {
|
||||
srv->query_cache_table = g_hash_table_new_full(g_str_hash,
|
||||
|
@ -959,7 +959,7 @@ network_mysqld_read_mul_packets(chassis G_GNUC_UNUSED *chas,
|
||||
}
|
||||
|
||||
if (query->warning_count > 0) {
|
||||
g_critical("%s warning flag from server:%s is met:%s",
|
||||
g_message("%s warning flag from server:%s is met:%s",
|
||||
G_STRLOC, server->dst->name->str, con->orig_sql->str);
|
||||
con->last_warning_met = 1;
|
||||
}
|
||||
@ -4341,6 +4341,11 @@ static retval_t proxy_self_read_handshake(chassis *srv, server_connection_state_
|
||||
return RET_ERROR;
|
||||
}
|
||||
|
||||
g_debug("%s: server version:%d", G_STRLOC, challenge->server_version);
|
||||
if (challenge->server_version >= 50700) {
|
||||
recv_sock->is_reset_conn_supported = 1;
|
||||
}
|
||||
|
||||
#ifndef SIMPLE_PARSER
|
||||
if (challenge->server_version < 50707) {
|
||||
g_warning("%s: for xa, server:%s, mysql version:%s is lower than 5.7.7",
|
||||
|
@ -149,6 +149,7 @@ typedef struct {
|
||||
unsigned int is_multi_stmt_set:1;
|
||||
unsigned int is_closed:1;
|
||||
unsigned int unavailable:1;
|
||||
unsigned int is_reset_conn_supported:1;
|
||||
unsigned int is_in_sess_context:1;
|
||||
unsigned int is_in_tran_context:1;
|
||||
unsigned int is_robbed:1;
|
||||
|
Loading…
Reference in New Issue
Block a user