| 1 |
TABLE: "setup_actors" |
| 2 |
INDEXES: PK (USER, HOST, EVENT_NAME) |
| 3 |
|
| 4 |
===== SETUP ===== |
| 5 |
## Connection Default |
| 6 |
## Disable events from the default connection |
| 7 |
|
| 8 |
## Create user1, user2, user3 |
| 9 |
CREATE USER user1@localhost; |
| 10 |
CREATE USER user2@localhost; |
| 11 |
CREATE USER user3@localhost; |
| 12 |
GRANT ALL ON *.* to 'user1'@localhost; |
| 13 |
GRANT ALL ON *.* to 'user2'@localhost; |
| 14 |
GRANT ALL ON *.* to 'user3'@localhost; |
| 15 |
|
| 16 |
## Setup test connection 1 |
| 17 |
## Setup test connection 2 |
| 18 |
## Setup test connection 3 |
| 19 |
|
| 20 |
## Default connection |
| 21 |
|
| 22 |
## Create data tables |
| 23 |
CREATE TABLE test.t1(a INT, b INT, c INT, d INT DEFAULT 0, PRIMARY KEY(a), INDEX index_b(b), INDEX index_cb(c, b)); |
| 24 |
CREATE TABLE test.t2 LIKE test.t1; |
| 25 |
CREATE TABLE test.t3 LIKE test.t1; |
| 26 |
|
| 27 |
## Generate event data from 3 connections |
| 28 |
## Connection 1 |
| 29 |
## Connection 2 |
| 30 |
## Connection 3 |
| 31 |
## Connection 2 |
| 32 |
## Create prepared statements on connection 2 |
| 33 |
PREPARE st1 FROM 'SELECT SQRT(POW(?,2) + POW(?,2)) AS hypotenuse'; |
| 34 |
PREPARE st3 FROM 'INSERT INTO test.t1 SELECT * FROM test.t1 WHERE a<=?'; |
| 35 |
PREPARE st4 FROM '(SELECT a FROM test.t1) UNION (SELECT a+10 FROM test.t1) ORDER BY RAND()*0+a'; |
| 36 |
## Create stored procedure connection 2 |
| 37 |
CREATE PROCEDURE SampleProc1() |
| 38 |
BEGIN |
| 39 |
SET @table = 'test.t1'; |
| 40 |
SET @s = CONCAT('SELECT * FROM ', @table); |
| 41 |
PREPARE st2 FROM @s; |
| 42 |
END| |
| 43 |
|
| 44 |
Call SampleProc1() to prepare a statement |
| 45 |
CALL SampleProc1(); |
| 46 |
## Connection default |
| 47 |
|
| 48 |
## Use Connection 2 for default target thread id |
| 49 |
|
| 50 |
## Create index_test() procedure |
| 51 |
insert into performance_schema.setup_actors values ("localhost","user1","%",'YES','YES'); |
| 52 |
insert into performance_schema.setup_actors values ("localhost","user2","%",'YES','YES'); |
| 53 |
insert into performance_schema.setup_actors values ("localhost","user3","%",'YES','YES'); |
| 54 |
|
| 55 |
===== BEGIN TEST ===== |
| 56 |
======== |
| 57 |
SELECT * FROM performance_schema.setup_actors WHERE user is null |
| 58 |
|
| 59 |
OK: Handler_read_key |
| 60 |
|
| 61 |
OK: Result set: Empty Expected: Empty |
| 62 |
|
| 63 |
OK: Extra rows: 0 Missing rows: 0 |
| 64 |
======== |
| 65 |
SELECT * FROM performance_schema.setup_actors WHERE user is not null |
| 66 |
|
| 67 |
OK: Handler_read_key |
| 68 |
|
| 69 |
OK: Result set: Non-empty Expected: Non-empty |
| 70 |
|
| 71 |
OK: Extra rows: 0 Missing rows: 0 |
| 72 |
======== |
| 73 |
SELECT * FROM performance_schema.setup_actors WHERE user = 'user1' and host is null |
| 74 |
|
| 75 |
OK: Handler_read_key |
| 76 |
|
| 77 |
OK: Result set: Empty Expected: Empty |
| 78 |
|
| 79 |
OK: Extra rows: 0 Missing rows: 0 |
| 80 |
======== |
| 81 |
SELECT * FROM performance_schema.setup_actors WHERE user = 'user1' and host is not null |
| 82 |
|
| 83 |
OK: Handler_read_key |
| 84 |
|
| 85 |
OK: Result set: Non-empty Expected: Non-empty |
| 86 |
|
| 87 |
OK: Extra rows: 0 Missing rows: 0 |
| 88 |
======== |
| 89 |
SELECT * FROM performance_schema.setup_actors WHERE user = 'user1' and host = 'localhost' and `role` is null |
| 90 |
|
| 91 |
OK: Handler_read_key |
| 92 |
|
| 93 |
OK: Result set: Empty Expected: Empty |
| 94 |
|
| 95 |
OK: Extra rows: 0 Missing rows: 0 |
| 96 |
======== |
| 97 |
SELECT * FROM performance_schema.setup_actors WHERE user = 'user1' and host = 'localhost' and `role` is not null |
| 98 |
|
| 99 |
OK: Handler_read_key |
| 100 |
|
| 101 |
OK: Result set: Non-empty Expected: Non-empty |
| 102 |
|
| 103 |
OK: Extra rows: 0 Missing rows: 0 |
| 104 |
======== |
| 105 |
SELECT * FROM performance_schema.setup_actors WHERE host = 'localhost' AND user = 'user1' |
| 106 |
|
| 107 |
OK: Handler_read_key |
| 108 |
|
| 109 |
OK: Result set: Non-empty Expected: Non-empty |
| 110 |
|
| 111 |
OK: Extra rows: 0 Missing rows: 0 |
| 112 |
======== |
| 113 |
SELECT * FROM performance_schema.setup_actors WHERE host = 'localhost' AND user = 'user1' AND `role` = '%' |
| 114 |
|
| 115 |
OK: Handler_read_key |
| 116 |
|
| 117 |
OK: Result set: Non-empty Expected: Non-empty |
| 118 |
|
| 119 |
OK: Extra rows: 0 Missing rows: 0 |
| 120 |
======== |
| 121 |
SELECT * FROM performance_schema.setup_actors WHERE host = 'localhost' AND user = 'user1' AND `role` = 'impossible' |
| 122 |
|
| 123 |
OK: Handler_read_key |
| 124 |
|
| 125 |
OK: Result set: Empty Expected: Empty |
| 126 |
|
| 127 |
OK: Extra rows: 0 Missing rows: 0 |
| 128 |
======== |
| 129 |
SELECT * FROM performance_schema.setup_actors WHERE host = 'nohost' AND user = 'nouser' AND `role` = '%' |
| 130 |
|
| 131 |
OK: Handler_read_key |
| 132 |
|
| 133 |
OK: Result set: Empty Expected: Empty |
| 134 |
|
| 135 |
OK: Extra rows: 0 Missing rows: 0 |
| 136 |
======== |
| 137 |
SELECT * FROM performance_schema.setup_actors WHERE host = 'localhost' AND user = 'nouser' AND `role` = '%' |
| 138 |
|
| 139 |
OK: Handler_read_key |
| 140 |
|
| 141 |
OK: Result set: Empty Expected: Empty |
| 142 |
|
| 143 |
OK: Extra rows: 0 Missing rows: 0 |
| 144 |
======== |
| 145 |
SELECT * FROM performance_schema.setup_actors WHERE host = 'nohost' AND user = 'user1' AND `role` = '%' |
| 146 |
|
| 147 |
OK: Handler_read_key |
| 148 |
|
| 149 |
OK: Result set: Empty Expected: Empty |
| 150 |
|
| 151 |
OK: Extra rows: 0 Missing rows: 0 |
| 152 |
TRUNCATE performance_schema.setup_actors; |
| 153 |
INSERT INTO performance_schema.setup_actors VALUES ('%', '%', '%', 'YES', 'YES'); |
| 154 |
|
| 155 |
===== CLEAN UP ===== |
| 156 |
## Default connection |
| 157 |
DEALLOCATE PREPARE st1; |
| 158 |
DEALLOCATE PREPARE st2; |
| 159 |
DEALLOCATE PREPARE st3; |
| 160 |
DEALLOCATE PREPARE st4; |
| 161 |
DROP PROCEDURE SampleProc1; |
| 162 |
DROP PROCEDURE index_test; |
| 163 |
DROP TABLE IF EXISTS test.indexes_off; |
| 164 |
DROP TABLE IF EXISTS test.indexes_on; |
| 165 |
DROP TABLE test.t1; |
| 166 |
DROP TABLE test.t2; |
| 167 |
DROP TABLE test.t3; |
| 168 |
REVOKE ALL PRIVILEGES, GRANT OPTION FROM user1@localhost; |
| 169 |
REVOKE ALL PRIVILEGES, GRANT OPTION FROM user2@localhost; |
| 170 |
REVOKE ALL PRIVILEGES, GRANT OPTION FROM user3@localhost; |
| 171 |
DROP USER user1@localhost; |
| 172 |
DROP USER user2@localhost; |
| 173 |
DROP USER user3@localhost; |
| 174 |
UPDATE performance_schema.threads SET INSTRUMENTED = 'YES'; |