diff options
Diffstat (limited to 'sql/sql_connect.cc')
-rw-r--r-- | sql/sql_connect.cc | 37 |
1 files changed, 17 insertions, 20 deletions
diff --git a/sql/sql_connect.cc b/sql/sql_connect.cc index 17aba33a76e..cb030296eec 100644 --- a/sql/sql_connect.cc +++ b/sql/sql_connect.cc @@ -37,7 +37,11 @@ // reset_host_errors #include "sql_acl.h" // acl_getroot, NO_ACCESS, SUPER_ACL #include "sql_callback.h" + +#ifdef WITH_WSREP +#include "wsrep_trans_observer.h" /* wsrep open/close */ #include "wsrep_mysqld.h" +#endif /* WITH_WSREP */ #include "proxy_protocol.h" HASH global_user_stats, global_client_stats, global_table_stats; @@ -1032,12 +1036,16 @@ static int check_connection(THD *thd) */ statistic_increment(connection_errors_peer_addr, &LOCK_status); my_error(ER_BAD_HOST_ERROR, MYF(0)); + statistic_increment(aborted_connects_preauth, &LOCK_status); return 1; } if (thd_set_peer_addr(thd, &net->vio->remote, ip, peer_port, true, &connect_errors)) + { + statistic_increment(aborted_connects_preauth, &LOCK_status); return 1; + } } else /* Hostname given means that the connection was on a socket */ { @@ -1065,6 +1073,7 @@ static int check_connection(THD *thd) */ statistic_increment(aborted_connects,&LOCK_status); statistic_increment(connection_errors_internal, &LOCK_status); + statistic_increment(aborted_connects_preauth, &LOCK_status); return 1; /* The error is set by alloc(). */ } @@ -1178,17 +1187,6 @@ exit: void end_connection(THD *thd) { NET *net= &thd->net; -#ifdef WITH_WSREP - if (WSREP(thd)) - { - wsrep_status_t rcode= wsrep->free_connection(wsrep, thd->thread_id); - if (rcode) { - WSREP_WARN("wsrep failed to free connection context: %lld code: %d", - (longlong) thd->thread_id, rcode); - } - } - thd->wsrep_client_thread= 0; -#endif if (thd->user_connect) { @@ -1322,7 +1320,7 @@ bool thd_prepare_connection(THD *thd) prepare_new_connection_state(thd); #ifdef WITH_WSREP - thd->wsrep_client_thread= 1; + thd->wsrep_client_thread= true; #endif /* WITH_WSREP */ return FALSE; } @@ -1367,7 +1365,7 @@ void do_handle_one_connection(CONNECT *connect) delete connect; /* Make THD visible in show processlist */ - add_to_active_threads(thd); + server_threads.insert(thd); thd->thr_create_utime= thr_create_utime; /* We need to set this because of time_out_user_resource_limits */ @@ -1395,6 +1393,9 @@ void do_handle_one_connection(CONNECT *connect) create_user= FALSE; goto end_thread; } +#ifdef WITH_WSREP + wsrep_open(thd); +#endif /* WITH_WSREP */ while (thd_is_connection_alive(thd)) { @@ -1405,13 +1406,9 @@ void do_handle_one_connection(CONNECT *connect) end_connection(thd); #ifdef WITH_WSREP - if (WSREP(thd)) - { - mysql_mutex_lock(&thd->LOCK_thd_data); - thd->wsrep_query_state= QUERY_EXITING; - mysql_mutex_unlock(&thd->LOCK_thd_data); - } -#endif + wsrep_close(thd); +#endif /* WITH_WSREP */ + end_thread: close_connection(thd); |