Commit a61baa7a authored by Sergey Vojtovich's avatar Sergey Vojtovich

Maintain connection_count atomically

Removed LOCK_connection_count.

Removed duplicate denied_connections and connection_errors_max_connection
increment from create_new_thread(). Another increment done by
CONNECT::close_with_error().

Simplified away CONNECT::thread_count_incremented. Now close_with_error()
is always called with connection_count incremented.

Part of MDEV-19515 - Improve connect speed
parent 0bee021b
......@@ -92,8 +92,6 @@ void mysql_audit_release(THD *thd);
bool thd_is_connection_alive(THD *thd);
/* Close connection with possible error code */
void close_connection(THD *thd, uint errcode);
/* Decrement connection counter */
void dec_connection_count();
/* Destroy THD object */
void delete_thd(THD *thd);
......
......@@ -27,9 +27,6 @@ execute dump_hosts;
# Notes about this test
#
# Each connect causes 2 wait/synch/mutex/sql/LOCK_connection_count events:
# - 1 in mysqld.cc, create_new_thread(), for the main thread
# - 1 in sql_connect.cc, check_user(), for the connected thread
# The main thread does not count for BY_ACCOUNT / BY_HOST.
# The user thread does count for BY_ACCOUNT, BY_HOST
#
......
......@@ -111,8 +111,7 @@ update performance_schema.threads set instrumented='NO';
update performance_schema.setup_instruments set enabled='NO', timed='NO';
update performance_schema.setup_instruments set enabled='YES', timed='YES'
where name in ('wait/synch/mutex/sql/LOCK_connection_count',
'wait/synch/mutex/sql/LOCK_user_locks',
where name in ('wait/synch/mutex/sql/LOCK_user_locks',
'wait/synch/rwlock/sql/LOCK_grant',
'wait/io/file/sql/query_log',
'idle');
......@@ -181,8 +180,7 @@ begin
if (my_thread_id is not null) then
select username, event_name, count_star
from performance_schema.events_waits_summary_by_thread_by_event_name
where event_name in ('wait/synch/mutex/sql/LOCK_connection_count',
'wait/synch/mutex/sql/LOCK_user_locks',
where event_name in ('wait/synch/mutex/sql/LOCK_user_locks',
'wait/synch/rwlock/sql/LOCK_grant',
'wait/io/file/sql/query_log')
and thread_id = my_thread_id
......@@ -199,8 +197,7 @@ prepare dump_waits_account from
"select user, host, event_name, count_star
from performance_schema.events_waits_summary_by_account_by_event_name
where user like \'user%\'
and event_name in ('wait/synch/mutex/sql/LOCK_connection_count',
'wait/synch/mutex/sql/LOCK_user_locks',
and event_name in ('wait/synch/mutex/sql/LOCK_user_locks',
'wait/synch/rwlock/sql/LOCK_grant',
'wait/io/file/sql/query_log')
order by user, host, event_name;";
......@@ -209,8 +206,7 @@ prepare dump_waits_user from
"select user, event_name, count_star
from performance_schema.events_waits_summary_by_user_by_event_name
where user like \'user%\'
and event_name in ('wait/synch/mutex/sql/LOCK_connection_count',
'wait/synch/mutex/sql/LOCK_user_locks',
and event_name in ('wait/synch/mutex/sql/LOCK_user_locks',
'wait/synch/rwlock/sql/LOCK_grant',
'wait/io/file/sql/query_log')
order by user, event_name;";
......@@ -219,8 +215,7 @@ prepare dump_waits_host from
"select host, event_name, count_star
from performance_schema.events_waits_summary_by_host_by_event_name
where host=\'localhost\'
and event_name in ('wait/synch/mutex/sql/LOCK_connection_count',
'wait/synch/mutex/sql/LOCK_user_locks',
and event_name in ('wait/synch/mutex/sql/LOCK_user_locks',
'wait/synch/rwlock/sql/LOCK_grant',
'wait/io/file/sql/query_log')
order by host, event_name;";
......@@ -228,8 +223,7 @@ prepare dump_waits_host from
prepare dump_waits_global from
"select event_name, count_star
from performance_schema.events_waits_summary_global_by_event_name
where event_name in ('wait/synch/mutex/sql/LOCK_connection_count',
'wait/synch/mutex/sql/LOCK_user_locks',
where event_name in ('wait/synch/mutex/sql/LOCK_user_locks',
'wait/synch/rwlock/sql/LOCK_grant',
'wait/io/file/sql/query_log')
order by event_name;";
......@@ -237,8 +231,7 @@ prepare dump_waits_global from
prepare dump_waits_history from
"select event_name, count(event_name)
from performance_schema.events_waits_history_long
where event_name in ('wait/synch/mutex/sql/LOCK_connection_count',
'wait/synch/mutex/sql/LOCK_user_locks',
where event_name in ('wait/synch/mutex/sql/LOCK_user_locks',
'wait/synch/rwlock/sql/LOCK_grant',
'wait/io/file/sql/query_log')
group by event_name order by event_name;";
......
......@@ -88,10 +88,6 @@ where name like "wait/synch/mutex/sql/LOCK_prepared_stmt_count";
count(name)
1
select count(name) from mutex_instances
where name like "wait/synch/mutex/sql/LOCK_connection_count";
count(name)
1
select count(name) from mutex_instances
where name like "wait/synch/mutex/sql/LOCK_server_started";
count(name)
1
......
......@@ -85,9 +85,6 @@ select count(name) from mutex_instances
select count(name) from mutex_instances
where name like "wait/synch/mutex/sql/LOCK_prepared_stmt_count";
select count(name) from mutex_instances
where name like "wait/synch/mutex/sql/LOCK_connection_count";
select count(name) from mutex_instances
where name like "wait/synch/mutex/sql/LOCK_server_started";
......
This diff is collapsed.
This diff is collapsed.
......@@ -112,7 +112,7 @@ void post_kill_notification(THD *thd)
void one_thread_per_connection_scheduler(scheduler_functions *func,
ulong *arg_max_connections,
uint *arg_connection_count)
Atomic_counter<uint> *arg_connection_count)
{
scheduler_init();
func->max_threads= *arg_max_connections + 1;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment