Debian Codegraph @

mysql-test/suite/perfschema/t/start_server_no_table_lock.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
18 #######################
19 # Execute few queries.
20 #######################
21 insert into db1.t1 values('1', 'abc');
22 insert into db1.t1 values('2', 'abc');
23 --disable_ps2_protocol
24 select * from db1.t1 where a='1';
25 --enable_ps2_protocol
26
27 #####################################################
28 # Run few queries on Performance Schema stats tables.
29 #####################################################
30 # There should be 3 entries in following table. 2 for insert and 1 for select.
31 # This is because lock stats are still in the table handles
32 select COUNT_STAR from performance_schema.table_lock_waits_summary_by_table
33 where OBJECT_SCHEMA='db1' and OBJECT_NAME='t1';
34
35 # Now force aggregation by closing table handles
36 FLUSH TABLES;
37
38 select COUNT_STAR from performance_schema.table_lock_waits_summary_by_table
39 where OBJECT_SCHEMA='db1' and OBJECT_NAME='t1';
40
41 # Expect TABLE_LOCK_STAT lost
42 --disable_warnings
43 select variable_value > 0 from information_schema.global_status
44 where variable_name like 'PERFORMANCE_SCHEMA_TABLE_LOCK_STAT_LOST';
45
46 # While at it, check that FLUSH STATUS Resets the lost counter
47 FLUSH GLOBAL STATUS;
48
49 select variable_value from information_schema.global_status
50 where variable_name like 'PERFORMANCE_SCHEMA_TABLE_LOCK_STAT_LOST';
51 --enable_warnings
52
53 ###########
54 # Cleanup.
55 ###########
56 drop database db1;