From 3f619478f796eddbba6e39502fe941b285dd97b1 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 4 May 2024 20:00:34 +0200 Subject: Adding upstream version 1:10.11.6. Signed-off-by: Daniel Baumann --- .../suite/perfschema/include/connection_setup.inc | 114 +++++++++++++++++++++ 1 file changed, 114 insertions(+) create mode 100644 mysql-test/suite/perfschema/include/connection_setup.inc (limited to 'mysql-test/suite/perfschema/include/connection_setup.inc') diff --git a/mysql-test/suite/perfschema/include/connection_setup.inc b/mysql-test/suite/perfschema/include/connection_setup.inc new file mode 100644 index 00000000..93b8e959 --- /dev/null +++ b/mysql-test/suite/perfschema/include/connection_setup.inc @@ -0,0 +1,114 @@ +# Tests for the performance schema + +# ============= +# DOCUMENTATION +# ============= + +# Verify how connections are counted into various tables: +# - accounts +# - users +# - hosts +# +# The tests are written with the following helpers: +# - include/connection_setup.inc +# - include/connection_load.inc +# - include/connection_cleanup.inc +# +# Helpers are intended to be used as follows. +# +# A Typical test t/connection_xxx.test will consist of: +# --source ../include/connection_setup.inc +# --source ../include/connection_load.inc +# --source ../include/connection_cleanup.inc +# and a t/connection_xxx-master.opt file +# +# Naming conventions for t/connection_xxx.test are as follows: +# t/connection_ +# +# corresponds to different sizing settings for +# the variable performance-schema-accounts-size +# - (blank): accounts-size sufficient to represent all records +# - 3a: accounts-size set to 3 +# - no_a: accounts-size set to 0 +# +# corresponds to different sizing settings for +# the variable performance-schema-users-size +# - (blank): users-size sufficient to represent all records +# - 3u: users-size set to 3 +# - no_u: users-size set to 0 +# +# corresponds to different sizing settings for +# the variable performance-schema-hosts-size +# - (blank): hosts-size sufficient to represent all records +# - no_h: hosts-size set to 0 + +# ======================================== +# HELPER include/event_aggregate_setup.inc +# ======================================== + +--source include/not_embedded.inc +--source include/have_perfschema.inc +--source include/no_protocol.inc +--source ../include/wait_for_pfs_thread_count.inc + +--disable_query_log + +create user user1@localhost; +grant ALL on *.* to user1@localhost; +create user user2@localhost; +grant ALL on *.* to user2@localhost; +create user user3@localhost; +grant ALL on *.* to user3@localhost; +create user user4@localhost; +grant ALL on *.* to user4@localhost; +create user user5@localhost; +grant ALL on *.* to user5@localhost; + +flush privileges; + +# Purge old users, hosts, user/host from previous tests +truncate table performance_schema.accounts; +truncate table performance_schema.users; +truncate table performance_schema.hosts; + +# Save the setup + +# Start from a known clean state, to avoid noise from previous tests +flush tables; +flush status; + +--disable_warnings +drop procedure if exists dump_all; +--enable_warnings + +delimiter $$; + +create procedure dump_all() +begin + select processlist_user, processlist_host + from performance_schema.threads + where (processlist_user is not null) and (processlist_host is not null) + order by processlist_user; + + select * from performance_schema.accounts + where (user is not null) and (host is not null) + order by user, host; + + select * from performance_schema.users + where user is not null + order by user; + + select * from performance_schema.hosts + where host is not null + order by host; + + select variable_name, variable_value from information_schema.global_status + where variable_name in ('PERFORMANCE_SCHEMA_ACCOUNTS_LOST', + 'PERFORMANCE_SCHEMA_USERS_LOST', + 'PERFORMANCE_SCHEMA_HOSTS_LOST'); +end +$$ + +delimiter ;$$ + +--enable_query_log -- cgit v1.2.3