| 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 |
| 10 |
let $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 |
| 17 |
SELECT 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 |
| 25 |
SELECT 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 |
| 33 |
SELECT 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 |
| 41 |
SELECT COUNT(DISTINCT PROCESSLIST_ID) |
| 42 |
FROM performance_schema.session_account_connect_attrs; |
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
CREATE USER wl5924@localhost; |
| 47 |
|
| 48 |
connect(non_privileged_user,localhost,wl5924,,"*NO-ONE*"); |
| 49 |
connection default; |
| 50 |
|
| 51 |
--echo # must return 1 |
| 52 |
SELECT COUNT(DISTINCT PROCESSLIST_ID) |
| 53 |
FROM performance_schema.session_account_connect_attrs; |
| 54 |
|
| 55 |
--echo # must return 2 |
| 56 |
SELECT COUNT(DISTINCT PROCESSLIST_ID) |
| 57 |
FROM performance_schema.session_connect_attrs; |
| 58 |
|
| 59 |
connection non_privileged_user; |
| 60 |
--echo # must return 1 |
| 61 |
SELECT COUNT(DISTINCT PROCESSLIST_ID) |
| 62 |
FROM performance_schema.session_account_connect_attrs; |
| 63 |
|
| 64 |
--error ER_TABLEACCESS_DENIED_ERROR |
| 65 |
SELECT COUNT(DISTINCT PROCESSLIST_ID) |
| 66 |
FROM performance_schema.session_connect_attrs; |
| 67 |
|
| 68 |
connection default; |
| 69 |
disconnect non_privileged_user; |
| 70 |
|
| 71 |
grant select on performance_schema.* to wl5924@localhost; |
| 72 |
change_user wl5924; |
| 73 |
SELECT SUM(ISNULL(ATTR_VALUE)), COUNT(*) |
| 74 |
FROM performance_schema.session_account_connect_attrs |
| 75 |
WHERE ATTR_NAME IN ('_os', '_client_name', '_pid', |
| 76 |
'_client_version', '_platform', 'program_name') |
| 77 |
AND PROCESSLIST_ID = CONNECTION_ID(); |
| 78 |
change_user root,,test; |
| 79 |
|
| 80 |
DROP USER wl5924@localhost; |
| 81 |
|
| 82 |
# Wait till all disconnects are completed |
| 83 |
--source include/wait_until_count_sessions.inc |