diff options
author | anozdrin/alik@station. <> | 2007-09-13 17:30:44 +0400 |
---|---|---|
committer | anozdrin/alik@station. <> | 2007-09-13 17:30:44 +0400 |
commit | ef3bcaf3dd46d6a4bc7a38d7a50924eb970148c1 (patch) | |
tree | 192e2180c3b62842a84864659e8796b24ddf4587 /sql/sql_parse.cc | |
parent | f4b671d8bc1ab80342918820a2bc841c5542d57d (diff) | |
download | mariadb-git-ef3bcaf3dd46d6a4bc7a38d7a50924eb970148c1.tar.gz |
Bug#16918: Aborted_clients > Connections.
The problem was that aborted_threads variable was updated
twice when a client connection had been aborted.
The fix is to refactor a code to have aborted_threads updated
only in one place.
Diffstat (limited to 'sql/sql_parse.cc')
-rw-r--r-- | sql/sql_parse.cc | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 58f5ffc5235..99a61d95619 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -93,6 +93,8 @@ const char *xa_state_names[]={ "NON-EXISTING", "ACTIVE", "IDLE", "PREPARED" }; +static bool do_command(THD *thd); + #ifdef __WIN__ static void test_signal(int sig_ptr) { @@ -1199,23 +1201,28 @@ pthread_handler_t handle_one_connection(void *arg) } if (thd->user_connect) decrease_user_connections(thd->user_connect); + + if (thd->killed || + net->vio && net->error && net->report_error) + { + statistic_increment(aborted_threads, &LOCK_status); + } + if (net->error && net->vio != 0 && net->report_error) { if (!thd->killed && thd->variables.log_warnings > 1) - sql_print_warning(ER(ER_NEW_ABORTING_CONNECTION), + { + sql_print_warning(ER(ER_NEW_ABORTING_CONNECTION), thd->thread_id,(thd->db ? thd->db : "unconnected"), sctx->user ? sctx->user : "unauthenticated", sctx->host_or_ip, (net->last_errno ? ER(net->last_errno) : ER(ER_UNKNOWN_ERROR))); + } + net_send_error(thd, net->last_errno, NullS); - statistic_increment(aborted_threads,&LOCK_status); } - else if (thd->killed) - { - statistic_increment(aborted_threads,&LOCK_status); - } - + end_thread: close_connection(thd, 0, 1); end_thread(thd,1); @@ -1550,12 +1557,12 @@ bool do_command(THD *thd) DBUG_PRINT("info",("Got error %d reading command from socket %s", net->error, vio_description(net->vio))); + /* Check if we can continue without closing the connection */ + if (net->error != 3) - { - statistic_increment(aborted_threads,&LOCK_status); DBUG_RETURN(TRUE); // We have to close it. - } + net_send_error(thd, net->last_errno, NullS); net->error= 0; DBUG_RETURN(FALSE); |