mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +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 log_warnings=default;
|
||||||
SET GLOBAL connect_timeout= @save_connect_timeout;
|
SET GLOBAL connect_timeout= @save_connect_timeout;
|
||||||
# End of 10.4 tests
|
# 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;
|
SET GLOBAL connect_timeout= @save_connect_timeout;
|
||||||
|
|
||||||
--echo # End of 10.4 tests
|
--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;
|
THD *thd;
|
||||||
if (!(thd= connect->create_thd(NULL)))
|
if (!(thd= connect->create_thd(NULL)))
|
||||||
{
|
{
|
||||||
connect->close_and_delete();
|
connect->close_and_delete(0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1437,7 +1437,7 @@ end_thread:
|
|||||||
if (!(connect->create_thd(thd)))
|
if (!(connect->create_thd(thd)))
|
||||||
{
|
{
|
||||||
/* Out of resources. Free thread to get more resources */
|
/* Out of resources. Free thread to get more resources */
|
||||||
connect->close_and_delete();
|
connect->close_and_delete(0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
delete connect;
|
delete connect;
|
||||||
@@ -1466,9 +1466,11 @@ end_thread:
|
|||||||
Close connection without error and delete the connect object
|
Close connection without error and delete the connect object
|
||||||
This and close_with_error are only called if we didn't manage to
|
This and close_with_error are only called if we didn't manage to
|
||||||
create a new thd object.
|
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");
|
DBUG_ENTER("close_and_delete");
|
||||||
|
|
||||||
@@ -1482,6 +1484,10 @@ void CONNECT::close_and_delete()
|
|||||||
vio_type= VIO_CLOSED;
|
vio_type= VIO_CLOSED;
|
||||||
|
|
||||||
--*scheduler->connection_count;
|
--*scheduler->connection_count;
|
||||||
|
|
||||||
|
if (err == ER_CON_COUNT_ERROR)
|
||||||
|
statistic_increment(connection_errors_max_connection, &LOCK_status);
|
||||||
|
else
|
||||||
statistic_increment(connection_errors_internal, &LOCK_status);
|
statistic_increment(connection_errors_internal, &LOCK_status);
|
||||||
statistic_increment(aborted_connects,&LOCK_status);
|
statistic_increment(aborted_connects,&LOCK_status);
|
||||||
|
|
||||||
@@ -1506,7 +1512,7 @@ void CONNECT::close_with_error(uint sql_errno,
|
|||||||
delete thd;
|
delete thd;
|
||||||
set_current_thd(0);
|
set_current_thd(0);
|
||||||
}
|
}
|
||||||
close_and_delete();
|
close_and_delete(close_error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -61,7 +61,7 @@ public:
|
|||||||
count--;
|
count--;
|
||||||
DBUG_ASSERT(vio_type == VIO_CLOSED);
|
DBUG_ASSERT(vio_type == VIO_CLOSED);
|
||||||
}
|
}
|
||||||
void close_and_delete();
|
void close_and_delete(uint err);
|
||||||
void close_with_error(uint sql_errno,
|
void close_with_error(uint sql_errno,
|
||||||
const char *message, uint close_error);
|
const char *message, uint close_error);
|
||||||
THD *create_thd(THD *thd);
|
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)))
|
if (!mysys_var ||!(thd= connect->create_thd(NULL)))
|
||||||
{
|
{
|
||||||
/* Out of memory? */
|
/* Out of memory? */
|
||||||
connect->close_and_delete();
|
connect->close_and_delete(0);
|
||||||
if (mysys_var)
|
if (mysys_var)
|
||||||
my_thread_end();
|
my_thread_end();
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -417,7 +417,7 @@ static void tp_add_connection(CONNECT *connect)
|
|||||||
if (c)
|
if (c)
|
||||||
pool->add(c);
|
pool->add(c);
|
||||||
else
|
else
|
||||||
connect->close_and_delete();
|
connect->close_and_delete(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int tp_get_idle_thread_count()
|
int tp_get_idle_thread_count()
|
||||||
|
Reference in New Issue
Block a user