MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
connection_setup.inc
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 grant ALL on *.* to user1@localhost;
57 grant ALL on *.* to user2@localhost;
58 grant ALL on *.* to user3@localhost;
59 grant ALL on *.* to user4@localhost;
60 grant ALL on *.* to user5@localhost;
61 
62 flush privileges;
63 
64 # Purge old users, hosts, user/host from previous tests
65 truncate table performance_schema.accounts;
66 truncate table performance_schema.users;
67 truncate table performance_schema.hosts;
68 
69 # Save the setup
70 
71 # Start from a known clean state, to avoid noise from previous tests
72 flush tables;
73 flush status;
74 
75 --disable_warnings
76 drop procedure if exists dump_all;
77 --enable_warnings
78 
79 delimiter $$;
80 
81 create procedure dump_all()
82 begin
83  select processlist_user, processlist_host
84  from performance_schema.threads
85  where (processlist_user is not null) and (processlist_host is not null)
86  order by processlist_user;
87 
88  select * from performance_schema.accounts
89  where (user is not null) and (host is not null)
90  order by user, host;
91 
92  select * from performance_schema.users
93  where user is not null
94  order by user;
95 
96  select * from performance_schema.hosts
97  where host is not null
98  order by host;
99 
100  select variable_name, variable_value from information_schema.global_status
101  where variable_name in ('PERFORMANCE_SCHEMA_ACCOUNTS_LOST',
102  'PERFORMANCE_SCHEMA_USERS_LOST',
103  'PERFORMANCE_SCHEMA_HOSTS_LOST');
104 end
105 $$
106 
107 delimiter ;$$
108 
109 --enable_query_log