1# Session connect attributes test
2--source include/have_perfschema.inc
3
4# although the connection attributes transfer code works
5# with embedded P_S is not active, so the test won't run.
6# TODO: remove this when P_S works with embedded.
7--source include/not_embedded.inc
8
9# make sure we're alone
10let $count_sessions= 1;
11--source include/wait_until_count_sessions.inc
12
13# basic performance_schema.session_connect_attrs tests
14
15# check the presense of the pre-defined attributes
16--echo # must return 0, 6
17SELECT SUM(ISNULL(ATTR_VALUE)), COUNT(*)
18  FROM performance_schema.session_connect_attrs
19  WHERE ATTR_NAME IN ('_os', '_client_name', '_pid',
20                      '_client_version', '_platform', 'program_name')
21    AND PROCESSLIST_ID = CONNECTION_ID();
22
23# check the presense of the pre-defined attributes
24--echo # must return 1
25SELECT COUNT(DISTINCT PROCESSLIST_ID)
26  FROM performance_schema.session_connect_attrs;
27
28
29# basic performance_schema.session_account_connect_attrs tests
30
31# check the presense of the pre-defined attributes
32--echo # must return 0, 6
33SELECT SUM(ISNULL(ATTR_VALUE)), COUNT(*)
34  FROM performance_schema.session_account_connect_attrs
35  WHERE ATTR_NAME IN ('_os', '_client_name', '_pid',
36                      '_client_version', '_platform', 'program_name')
37    AND PROCESSLIST_ID = CONNECTION_ID();
38
39# check the presense of the pre-defined attributes
40--echo # must return 1
41SELECT COUNT(DISTINCT PROCESSLIST_ID)
42  FROM performance_schema.session_account_connect_attrs;
43
44
45
46CREATE USER wl5924@localhost;
47
48connect(non_privileged_user,localhost,wl5924,,test);
49connection default;
50
51--echo # must return 1
52SELECT COUNT(DISTINCT PROCESSLIST_ID)
53  FROM performance_schema.session_account_connect_attrs;
54
55--echo # must return 2
56SELECT COUNT(DISTINCT PROCESSLIST_ID)
57  FROM performance_schema.session_connect_attrs;
58
59connection non_privileged_user;
60--echo # must return 1
61SELECT COUNT(DISTINCT PROCESSLIST_ID)
62  FROM performance_schema.session_account_connect_attrs;
63
64--error ER_TABLEACCESS_DENIED_ERROR
65SELECT COUNT(DISTINCT PROCESSLIST_ID)
66  FROM performance_schema.session_connect_attrs;
67
68connection default;
69disconnect non_privileged_user;
70
71DROP USER wl5924@localhost;
72
73# Wait till all disconnects are completed
74--source include/wait_until_count_sessions.inc
75