Debian Codegraph @

mysql-test/suite/perfschema/t/start_server_no_index.test

raw
1 # Tests for PERFORMANCE_SCHEMA
2
3 --source include/not_embedded.inc
4 --source include/have_perfschema.inc
5
6 --source ../include/start_server_common.inc
7
8 #############################
9 # Setup database and tables.
10 #############################
11 --disable_warnings
12 drop table if exists db1.t1;
13 drop database if exists db1;
14 --enable_warnings
15 create database db1;
16 create table db1.t1 (a int, b char(10) default 'default',
17 unique key uidx(a));
18
19 #######################
20 # Execute few queries.
21 #######################
22 insert into db1.t1 values('1', 'abc');
23 insert into db1.t1 values('2', 'abc');
24 --disable_ps2_protocol
25 select * from db1.t1 where a='1';
26 --enable_ps2_protocol
27
28 #####################################################
29 # Run few queries on Performance Schema stats tables.
30 #####################################################
31 # There should be 3 entries in following table. 2 for insert and 1 for select.
32 # This is because lock stats are still in the table handles
33 select COUNT_STAR from performance_schema.table_io_waits_summary_by_table
34 where OBJECT_SCHEMA='db1' and OBJECT_NAME='t1';
35 # There should be 1 entry in following table. Thats is for select.
36 # This is because lock stats are still in the table handles
37 select COUNT_STAR from performance_schema.table_io_waits_summary_by_index_usage
38 where INDEX_NAME!='NULL';
39
40 # Now force aggregation by closing table handles
41 FLUSH TABLES;
42
43 # Stats are now missing
44 select COUNT_STAR from performance_schema.table_io_waits_summary_by_table
45 where OBJECT_SCHEMA='db1' and OBJECT_NAME='t1';
46
47 # Stats are now missing
48 select COUNT_STAR from performance_schema.table_io_waits_summary_by_index_usage
49 where INDEX_NAME!='NULL';
50
51 # Expect INDEX_STAT lost
52 --disable_warnings
53 select variable_value > 0 from information_schema.global_status
54 where variable_name like 'PERFORMANCE_SCHEMA_INDEX_STAT_LOST';
55
56 # While at it, check that FLUSH GLOBAL STATUS Resets the lost counter
57 FLUSH GLOBAL STATUS;
58
59 select variable_value from information_schema.global_status
60 where variable_name like 'PERFORMANCE_SCHEMA_INDEX_STAT_LOST';
61 --enable_warnings
62
63 ###########
64 # Cleanup.
65 ###########
66 drop database db1;