| 1 |
|
| 2 |
# TEST 1 |
| 3 |
# Handling of SHOW STATUS/VARIABLES ... WHERE |
| 4 |
# |
| 5 |
SHOW STATUS WHERE VARIABLE_NAME LIKE "foo"; |
| 6 |
Variable_name Value |
| 7 |
|
| 8 |
SHOW GLOBAL STATUS WHERE VARIABLE_NAME LIKE "foo"; |
| 9 |
Variable_name Value |
| 10 |
|
| 11 |
SHOW SESSION STATUS WHERE VARIABLE_NAME LIKE "foo"; |
| 12 |
Variable_name Value |
| 13 |
|
| 14 |
SHOW VARIABLES WHERE VARIABLE_NAME LIKE "foo"; |
| 15 |
Variable_name Value |
| 16 |
|
| 17 |
SHOW GLOBAL VARIABLES WHERE VARIABLE_NAME LIKE "foo"; |
| 18 |
Variable_name Value |
| 19 |
|
| 20 |
SHOW SESSION VARIABLES WHERE VARIABLE_NAME LIKE "foo"; |
| 21 |
Variable_name Value |
| 22 |
|
| 23 |
# TEST 2 |
| 24 |
# CREATE..SELECT -- Expect correct ER_WARN_DEPRECATED_SYNTAX |
| 25 |
# |
| 26 |
USE test; |
| 27 |
CREATE TABLE t0 SELECT * FROM information_schema.global_status WHERE variable_name = 'COM_SELECT'; |
| 28 |
DROP TABLE t0; |
| 29 |
|
| 30 |
# TEST 3 |
| 31 |
# Select status and system variable tables using ORDER BY to exercise the |
| 32 |
# rnd_pos() method |
| 33 |
# |
| 34 |
use performance_schema; |
| 35 |
select * from global_variables order by variable_name; |
| 36 |
select * from variables_by_thread order by variable_name; |
| 37 |
select * from session_variables order by variable_name; |
| 38 |
select * from global_status order by variable_name; |
| 39 |
select * from session_status order by variable_name; |
| 40 |
select * from status_by_thread order by variable_name; |
| 41 |
select * from status_by_user order by variable_name; |
| 42 |
select * from status_by_host order by variable_name; |
| 43 |
select * from status_by_account order by variable_name; |
| 44 |
|
| 45 |
# TEST 4 |
| 46 |
# Handling of SHOW STATUS/VARIABLES ... WHERE |
| 47 |
# |
| 48 |
SHOW STATUS WHERE VARIABLE_NAME LIKE "foo"; |
| 49 |
Variable_name Value |
| 50 |
|
| 51 |
SHOW GLOBAL STATUS WHERE VARIABLE_NAME LIKE "foo"; |
| 52 |
Variable_name Value |
| 53 |
|
| 54 |
SHOW SESSION STATUS WHERE VARIABLE_NAME LIKE "foo"; |
| 55 |
Variable_name Value |
| 56 |
|
| 57 |
SHOW VARIABLES WHERE VARIABLE_NAME LIKE "foo"; |
| 58 |
Variable_name Value |
| 59 |
|
| 60 |
SHOW GLOBAL VARIABLES WHERE VARIABLE_NAME LIKE "foo"; |
| 61 |
Variable_name Value |
| 62 |
|
| 63 |
SHOW SESSION VARIABLES WHERE VARIABLE_NAME LIKE "foo"; |
| 64 |
Variable_name Value |
| 65 |
|
| 66 |
# TEST 5 |
| 67 |
# Confirm FLUSH STATUS resets counters for all threads. |
| 68 |
# |
| 69 |
|
| 70 |
# Create a new connection |
| 71 |
connect con1, localhost, root,,; |
| 72 |
|
| 73 |
# Record thread id |
| 74 |
|
| 75 |
# Increase bytes_received for new connection |
| 76 |
USE test; |
| 77 |
SHOW TABLES; |
| 78 |
Tables_in_test |
| 79 |
connection default; |
| 80 |
USE performance_schema; |
| 81 |
|
| 82 |
# Record bytes_received for other connection |
| 83 |
SELECT variable_value FROM status_by_thread |
| 84 |
WHERE variable_name = "bytes_received" and thread_id = @thread_id INTO @bytes_before; |
| 85 |
Warnings: |
| 86 |
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead |
| 87 |
Warning 1329 No data - zero rows fetched, selected, or processed |
| 88 |
|
| 89 |
# Reset status counters |
| 90 |
FLUSH STATUS; |
| 91 |
|
| 92 |
# Record bytes_received after reset |
| 93 |
SELECT variable_value FROM status_by_thread |
| 94 |
WHERE variable_name = "bytes_received" and thread_id = @thread_id INTO @bytes_after; |
| 95 |
Warnings: |
| 96 |
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead |
| 97 |
Warning 1329 No data - zero rows fetched, selected, or processed |
| 98 |
|
| 99 |
# Expect bytes_before > bytes_after |
| 100 |
SELECT @bytes_before > @bytes_after AS 'Expect 1'; |
| 101 |
Expect 1 |
| 102 |
NULL |
| 103 |
|
| 104 |
# Expect bytes_after is zero |
| 105 |
SELECT @bytes_after AS 'Expect 0'; |
| 106 |
Expect 0 |
| 107 |
NULL |
| 108 |
disconnect con1; |
| 109 |
|
| 110 |
# TEST 6 |
| 111 |
# |
| 112 |
# Bug#28291258 FLUSH STATUS ADDS TWICE TO GLOBAL VALUES |
| 113 |
# |
| 114 |
|
| 115 |
# Default connection |
| 116 |
|
| 117 |
# First connection |
| 118 |
connect con1, localhost, root,,; |
| 119 |
include/assert.inc [Global value requested from the first session must not change] |
| 120 |
|
| 121 |
# Generate a slow query |
| 122 |
|
| 123 |
SET long_query_time = 2; |
| 124 |
SELECT SLEEP(4); |
| 125 |
SLEEP(4) |
| 126 |
0 |
| 127 |
SET long_query_time = @@global.long_query_time; |
| 128 |
|
| 129 |
include/assert.inc [Global value requested from the first session after SLEEP() must increase by 1] |
| 130 |
include/assert.inc [First session value must increase by 1] |
| 131 |
connection default; |
| 132 |
disconnect con1; |
| 133 |
|
| 134 |
# Default connection |
| 135 |
connection default; |
| 136 |
include/assert.inc [Global value requested from the default session after DISCONNECT must remain the same] |
| 137 |
include/assert.inc [Default session value must remain zero] |
| 138 |
|
| 139 |
FLUSH STATUS; |
| 140 |
|
| 141 |
include/assert.inc [Global value requested from the default session after FLUSH must remain the same] |
| 142 |
include/assert.inc [Default session value after FLUSH must remain zero] |