Debian Codegraph @

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

raw
1 # Tests for PERFORMANCE_SCHEMA
2
3 --source ../include/start_server_common.inc
4
5 #############################
6 # Setup database and tables.
7 #############################
8 --disable_warnings
9 drop table if exists db1.t1;
10 drop database if exists db1;
11 --enable_warnings
12 create database db1;
13 create table db1.t1 (a int, b char(10) default 'default');
14
15 #######################
16 # Execute few queries.
17 #######################
18 insert into db1.t1 values('1', 'abc');
19 insert into db1.t1 values('2', 'abc');
20 select * from db1.t1 where a='1';
21
22 #####################################################
23 # Run few queries on Performance Schema stats tables.
24 #####################################################
25 # There should be 3 entries in following table. 2 for insert and 1 for select.
26 # This is because lock stats are still in the table handles
27 select COUNT_STAR from performance_schema.table_lock_waits_summary_by_table
28 where OBJECT_SCHEMA='db1' and OBJECT_NAME='t1';
29
30 # Now force aggregation by closing table handles
31 FLUSH TABLES;
32
33 select COUNT_STAR from performance_schema.table_lock_waits_summary_by_table
34 where OBJECT_SCHEMA='db1' and OBJECT_NAME='t1';
35
36 # Expect TABLE_LOCK_STAT lost
37 --disable_warnings
38 select variable_value > 0 from performance_schema.global_status
39 where variable_name like 'PERFORMANCE_SCHEMA_TABLE_LOCK_STAT_LOST';
40
41 # While at it, check that FLUSH STATUS Resets the lost counter
42 FLUSH STATUS;
43
44 select variable_value from performance_schema.global_status
45 where variable_name like 'PERFORMANCE_SCHEMA_TABLE_LOCK_STAT_LOST';
46 --enable_warnings
47
48 ###########
49 # Cleanup.
50 ###########
51 drop database db1;