diff --git a/plugins/admin/admin-plugin.c b/plugins/admin/admin-plugin.c index 958cde8..6824030 100644 --- a/plugins/admin/admin-plugin.c +++ b/plugins/admin/admin-plugin.c @@ -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)); diff --git a/plugins/proxy/proxy-plugin.c b/plugins/proxy/proxy-plugin.c index e9efb63..1ae8775 100644 --- a/plugins/proxy/proxy-plugin.c +++ b/plugins/proxy/proxy-plugin.c @@ -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); diff --git a/src/chassis-mainloop.h b/src/chassis-mainloop.h index c888ff9..9cb96f1 100644 --- a/src/chassis-mainloop.h +++ b/src/chassis-mainloop.h @@ -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; diff --git a/src/mysql-proxy-cli.c b/src/mysql-proxy-cli.c index efcad1c..b6cf90d 100644 --- a/src/mysql-proxy-cli.c +++ b/src/mysql-proxy-cli.c @@ -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, diff --git a/src/network-mysqld.c b/src/network-mysqld.c index 2000485..5d890be 100644 --- a/src/network-mysqld.c +++ b/src/network-mysqld.c @@ -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", diff --git a/src/network-socket.h b/src/network-socket.h index 1db450d..0ce243d 100644 --- a/src/network-socket.h +++ b/src/network-socket.h @@ -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;