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 # Test requires: sp-protocol/ps-protocol/view-protocol/cursor-protocol disabled
50 --source include/no_protocol.inc
51 --source ../include/wait_for_pfs_thread_count.inc
52
53 --disable_query_log
54
55 create user user1@localhost, user2@localhost,
56 user3@localhost, user4@localhost,
57 user5@localhost;
58 grant ALL on *.* to user1@localhost;
59 grant ALL on *.* to user2@localhost;
60 grant ALL on *.* to user3@localhost;
61 grant ALL on *.* to user4@localhost;
62 grant ALL on *.* to user5@localhost;
63
64 flush privileges;
65
66 # Purge old users, hosts, user/host from previous tests
67 truncate table performance_schema.accounts;
68 truncate table performance_schema.users;
69 truncate table performance_schema.hosts;
70
71 # Save the setup
72
73 # Start from a known clean state, to avoid noise from previous tests
74 flush tables;
75 flush status;
76
77 --disable_warnings
78 drop procedure if exists dump_all;
79 --enable_warnings
80
81 delimiter $$;
82
83 create procedure dump_all()
84 begin
85 select processlist_user, processlist_host
86 from performance_schema.threads
87 where (processlist_user is not null) and (processlist_host is not null)
88 order by processlist_user;
89
90 select USER, HOST, CURRENT_CONNECTIONS, TOTAL_CONNECTIONS from performance_schema.accounts
91 where (user is not null) and (host is not null)
92 order by user, host;
93
94 select USER, CURRENT_CONNECTIONS, TOTAL_CONNECTIONS from performance_schema.users
95 where user is not null
96 order by user;
97
98 select HOST, CURRENT_CONNECTIONS, TOTAL_CONNECTIONS from performance_schema.hosts
99 where host is not null
100 order by host;
101
102 select variable_name, variable_value from performance_schema.global_status
103 where variable_name in ('PERFORMANCE_SCHEMA_ACCOUNTS_LOST',
104 'PERFORMANCE_SCHEMA_USERS_LOST',
105 'PERFORMANCE_SCHEMA_HOSTS_LOST');
106 end
107 $$
108
109 delimiter ;$$
110
111 --enable_query_log