Debian Codegraph @

mysql-test/suite/perfschema/include/connection_setup.inc

raw
1 # Tests for the performance schema
2
3 # =============
4 # DOCUMENTATION
5 # =============
6
7 # Verify how connections are counted into various tables:
8 # - accounts
9 # - users
10 # - hosts
11 #
12 # The tests are written with the following helpers:
13 # - include/connection_setup.inc
14 # - include/connection_load.inc
15 # - include/connection_cleanup.inc
16 #
17 # Helpers are intended to be used as follows.
18 #
19 # A Typical test t/connection_xxx.test will consist of:
20 # --source ../include/connection_setup.inc
21 # --source ../include/connection_load.inc
22 # --source ../include/connection_cleanup.inc
23 # and a t/connection_xxx-master.opt file
24 #
25 # Naming conventions for t/connection_xxx.test are as follows:
26 # t/connection_<account><user><host>
27 #
28 # <account> corresponds to different sizing settings for
29 # the variable performance-schema-accounts-size
30 # - (blank): accounts-size sufficient to represent all records
31 # - 3a: accounts-size set to 3
32 # - no_a: accounts-size set to 0
33 #
34 # <user> corresponds to different sizing settings for
35 # the variable performance-schema-users-size
36 # - (blank): users-size sufficient to represent all records
37 # - 3u: users-size set to 3
38 # - no_u: users-size set to 0
39 #
40 # <host> corresponds to different sizing settings for
41 # the variable performance-schema-hosts-size
42 # - (blank): hosts-size sufficient to represent all records
43 # - no_h: hosts-size set to 0
44
45 # ========================================
46 # HELPER include/event_aggregate_setup.inc
47 # ========================================
48
49 --source include/not_embedded.inc
50 --source include/have_perfschema.inc
51 --source include/no_protocol.inc
52 --source ../include/wait_for_pfs_thread_count.inc
53
54 --disable_query_log
55
56 create user user1@localhost;
57 grant ALL on *.* to user1@localhost;
58 create user user2@localhost;
59 grant ALL on *.* to user2@localhost;
60 create user user3@localhost;
61 grant ALL on *.* to user3@localhost;
62 create user user4@localhost;
63 grant ALL on *.* to user4@localhost;
64 create user user5@localhost;
65 grant ALL on *.* to user5@localhost;
66
67 flush privileges;
68
69 # Purge old users, hosts, user/host from previous tests
70 truncate table performance_schema.accounts;
71 truncate table performance_schema.users;
72 truncate table performance_schema.hosts;
73
74 # Save the setup
75
76 # Start from a known clean state, to avoid noise from previous tests
77 flush tables;
78 flush global status;
79
80 --disable_warnings
81 drop procedure if exists dump_all;
82 --enable_warnings
83
84 delimiter $$;
85
86 create procedure dump_all()
87 begin
88 select processlist_user, processlist_host
89 from performance_schema.threads
90 where (processlist_user is not null) and (processlist_host is not null)
91 order by processlist_user;
92
93 select * from performance_schema.accounts
94 where (user is not null) and (host is not null)
95 order by user, host;
96
97 select * from performance_schema.users
98 where user is not null
99 order by user;
100
101 select * from performance_schema.hosts
102 where host is not null
103 order by host;
104
105 select variable_name, variable_value from information_schema.global_status
106 where variable_name in ('PERFORMANCE_SCHEMA_ACCOUNTS_LOST',
107 'PERFORMANCE_SCHEMA_USERS_LOST',
108 'PERFORMANCE_SCHEMA_HOSTS_LOST');
109 end
110 $$
111
112 delimiter ;$$
113
114 --enable_query_log