/usr/lib/mysql-testsuite/t/percona_userstat.test is in percona-server-test-5.6 5.6.22-rel71.0-0ubuntu4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | --source include/have_innodb.inc
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
# Test that FLUSH works with userstat disabled
SET GLOBAL userstat=OFF;
FLUSH CLIENT_STATISTICS;
FLUSH INDEX_STATISTICS;
FLUSH TABLE_STATISTICS;
FLUSH THREAD_STATISTICS;
FLUSH USER_STATISTICS;
# Test that I_S and SHOW queries work with userstat disabled
SELECT * FROM INFORMATION_SCHEMA.CLIENT_STATISTICS;
SELECT * FROM INFORMATION_SCHEMA.INDEX_STATISTICS;
SELECT * FROM INFORMATION_SCHEMA.TABLE_STATISTICS;
SELECT * FROM INFORMATION_SCHEMA.THREAD_STATISTICS;
SELECT * FROM INFORMATION_SCHEMA.USER_STATISTICS;
SHOW CLIENT_STATISTICS;
SHOW INDEX_STATISTICS;
SHOW TABLE_STATISTICS;
SHOW THREAD_STATISTICS;
SHOW USER_STATISTICS;
SET @userstat_old= @@userstat;
SET GLOBAL userstat=ON;
# Test that statistics start at empty state
--replace_column 3 CONNECTED_TIME 4 BUSY_TIME 5 CPU_TIME
SELECT * FROM INFORMATION_SCHEMA.CLIENT_STATISTICS;
SELECT * FROM INFORMATION_SCHEMA.INDEX_STATISTICS;
SELECT * FROM INFORMATION_SCHEMA.TABLE_STATISTICS;
--replace_column 3 CONNECTED_TIME 4 BUSY_TIME 5 CPU_TIME
SELECT * FROM INFORMATION_SCHEMA.THREAD_STATISTICS;
--replace_column 3 CONNECTED_TIME 4 BUSY_TIME 5 CPU_TIME
SELECT * FROM INFORMATION_SCHEMA.USER_STATISTICS;
--replace_column 3 CONNECTED_TIME 4 BUSY_TIME 5 CPU_TIME
SHOW CLIENT_STATISTICS;
SHOW INDEX_STATISTICS;
SHOW TABLE_STATISTICS;
--replace_column 3 CONNECTED_TIME 4 BUSY_TIME 5 CPU_TIME
SHOW THREAD_STATISTICS;
--replace_column 3 CONNECTED_TIME 4 BUSY_TIME 5 CPU_TIME
SHOW USER_STATISTICS;
# Bug 602047 (wrong rows_read value)
CREATE TABLE t1 (id int(10), PRIMARY KEY (id)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
SELECT COUNT(*) FROM t1;
SELECT ROWS_READ FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_NAME='t1';
SELECT ROWS_READ FROM INFORMATION_SCHEMA.INDEX_STATISTICS WHERE TABLE_NAME='t1';
# Test that FLUSH clears one table but not another
FLUSH TABLE_STATISTICS;
SELECT ROWS_READ FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_NAME='t1';
SELECT ROWS_READ FROM INFORMATION_SCHEMA.INDEX_STATISTICS WHERE TABLE_NAME='t1';
# Test that FLUSH clears both tables now
FLUSH INDEX_STATISTICS;
SELECT ROWS_READ FROM INFORMATION_SCHEMA.INDEX_STATISTICS WHERE TABLE_NAME='t1';
# Test that stats are collected after the FLUSH again
SELECT COUNT(*) FROM t1;
SELECT ROWS_READ FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_NAME='t1';
SELECT ROWS_READ FROM INFORMATION_SCHEMA.INDEX_STATISTICS WHERE TABLE_NAME='t1';
DROP TABLE t1;
# Bug 1183625 (handler::update_global_table_stats crash).
CREATE TABLE t2 (c1 INT UNSIGNED) ENGINE=InnoDB;
ALTER TABLE t2 MODIFY c1 FLOAT;
SELECT * FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_NAME='t2';
DROP TABLE t2;
SET GLOBAL userstat= @userstat_old;
|