mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
MDEV-33990: SHOW STATUS counts ER_CON_COUNT_ERROR as Connection_errors_internal
Bring info about cause of closing connection in the place where we increment statistics to do it correctly.
This commit is contained in:
@ -444,3 +444,33 @@ FOUND 2 /This connection closed normally without authentication/ in mysqld.1.err
|
||||
SET GLOBAL log_warnings=default;
|
||||
SET GLOBAL connect_timeout= @save_connect_timeout;
|
||||
# End of 10.4 tests
|
||||
#
|
||||
# MDEV-33990: SHOW STATUS counts ER_CON_COUNT_ERROR as
|
||||
# Connection_errors_internal
|
||||
#
|
||||
flush status;
|
||||
show global status like 'Connection_errors%';
|
||||
Variable_name Value
|
||||
Connection_errors_accept 0
|
||||
Connection_errors_internal 0
|
||||
Connection_errors_max_connections 0
|
||||
Connection_errors_peer_address 0
|
||||
Connection_errors_select 0
|
||||
Connection_errors_tcpwrap 0
|
||||
set @max_con.save= @@max_connections;
|
||||
set global max_connections= 10;
|
||||
# ERROR 1040
|
||||
# ERROR 1040
|
||||
connection default;
|
||||
show global status like 'Connection_errors%';
|
||||
Variable_name Value
|
||||
Connection_errors_accept 0
|
||||
Connection_errors_internal 0
|
||||
Connection_errors_max_connections 2
|
||||
Connection_errors_peer_address 0
|
||||
Connection_errors_select 0
|
||||
Connection_errors_tcpwrap 0
|
||||
set global max_connections= @max_con.save;
|
||||
#
|
||||
# End of 10.5 tests
|
||||
#
|
||||
|
@ -508,3 +508,38 @@ SET GLOBAL log_warnings=default;
|
||||
SET GLOBAL connect_timeout= @save_connect_timeout;
|
||||
|
||||
--echo # End of 10.4 tests
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-33990: SHOW STATUS counts ER_CON_COUNT_ERROR as
|
||||
--echo # Connection_errors_internal
|
||||
--echo #
|
||||
|
||||
flush status;
|
||||
|
||||
show global status like 'Connection_errors%';
|
||||
|
||||
set @max_con.save= @@max_connections;
|
||||
set global max_connections= 10;
|
||||
|
||||
--disable_result_log
|
||||
--disable_query_log
|
||||
--let $n= 12
|
||||
while ($n)
|
||||
{
|
||||
--error 0,ER_CON_COUNT_ERROR
|
||||
--connect (con$n,localhost,root)
|
||||
if ($mysql_errno) {
|
||||
--echo # ERROR $mysql_errno
|
||||
}
|
||||
--dec $n
|
||||
}
|
||||
|
||||
--enable_result_log
|
||||
--enable_query_log
|
||||
--connection default
|
||||
show global status like 'Connection_errors%';
|
||||
set global max_connections= @max_con.save;
|
||||
|
||||
--echo #
|
||||
--echo # End of 10.5 tests
|
||||
--echo #
|
||||
|
@ -1362,7 +1362,7 @@ void do_handle_one_connection(CONNECT *connect, bool put_in_cache)
|
||||
THD *thd;
|
||||
if (!(thd= connect->create_thd(NULL)))
|
||||
{
|
||||
connect->close_and_delete();
|
||||
connect->close_and_delete(0);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1437,7 +1437,7 @@ end_thread:
|
||||
if (!(connect->create_thd(thd)))
|
||||
{
|
||||
/* Out of resources. Free thread to get more resources */
|
||||
connect->close_and_delete();
|
||||
connect->close_and_delete(0);
|
||||
break;
|
||||
}
|
||||
delete connect;
|
||||
@ -1466,9 +1466,11 @@ end_thread:
|
||||
Close connection without error and delete the connect object
|
||||
This and close_with_error are only called if we didn't manage to
|
||||
create a new thd object.
|
||||
|
||||
Note: err can be 0 if unknown/not inportant
|
||||
*/
|
||||
|
||||
void CONNECT::close_and_delete()
|
||||
void CONNECT::close_and_delete(uint err)
|
||||
{
|
||||
DBUG_ENTER("close_and_delete");
|
||||
|
||||
@ -1482,7 +1484,11 @@ void CONNECT::close_and_delete()
|
||||
vio_type= VIO_CLOSED;
|
||||
|
||||
--*scheduler->connection_count;
|
||||
statistic_increment(connection_errors_internal, &LOCK_status);
|
||||
|
||||
if (err == ER_CON_COUNT_ERROR)
|
||||
statistic_increment(connection_errors_max_connection, &LOCK_status);
|
||||
else
|
||||
statistic_increment(connection_errors_internal, &LOCK_status);
|
||||
statistic_increment(aborted_connects,&LOCK_status);
|
||||
|
||||
delete this;
|
||||
@ -1506,7 +1512,7 @@ void CONNECT::close_with_error(uint sql_errno,
|
||||
delete thd;
|
||||
set_current_thd(0);
|
||||
}
|
||||
close_and_delete();
|
||||
close_and_delete(close_error);
|
||||
}
|
||||
|
||||
|
||||
|
@ -61,7 +61,7 @@ public:
|
||||
count--;
|
||||
DBUG_ASSERT(vio_type == VIO_CLOSED);
|
||||
}
|
||||
void close_and_delete();
|
||||
void close_and_delete(uint err);
|
||||
void close_with_error(uint sql_errno,
|
||||
const char *message, uint close_error);
|
||||
THD *create_thd(THD *thd);
|
||||
|
@ -241,7 +241,7 @@ static THD* threadpool_add_connection(CONNECT *connect, void *scheduler_data)
|
||||
if (!mysys_var ||!(thd= connect->create_thd(NULL)))
|
||||
{
|
||||
/* Out of memory? */
|
||||
connect->close_and_delete();
|
||||
connect->close_and_delete(0);
|
||||
if (mysys_var)
|
||||
my_thread_end();
|
||||
return NULL;
|
||||
@ -417,7 +417,7 @@ static void tp_add_connection(CONNECT *connect)
|
||||
if (c)
|
||||
pool->add(c);
|
||||
else
|
||||
connect->close_and_delete();
|
||||
connect->close_and_delete(0);
|
||||
}
|
||||
|
||||
int tp_get_idle_thread_count()
|
||||
|
Reference in New Issue
Block a user