Debian Codegraph @

mysql-test/suite/sysschema/t/v_schema_table_lock_waits.test

raw
1 -- source include/not_embedded.inc
2 -- source include/have_innodb.inc
3 -- source ../include/ps_truncate_all_tables.inc
4 # Tests for sys schema
5 # Verify the sys.schema_table_lock_waits view
6
7 # Ensure structure changes don't slip in
8 DESC sys.schema_table_lock_waits;
9
10 # Make sure view select does not error, but ignore results
11 --disable_result_log
12 SELECT * FROM sys.schema_table_lock_waits;
13 --enable_result_log
14
15
16 # Ensure structure changes don't slip in
17 DESC sys.x$schema_table_lock_waits;
18
19 # Make sure view select does not error, but ignore results
20 --disable_result_log
21 SELECT * FROM sys.x$schema_table_lock_waits;
22 --enable_result_log
23
24 # Ensure lock waits show up correctly
25 --connect(con1,localhost,root,,)
26 --connect(con2,localhost,root,,)
27
28 connection con1;
29 CREATE TABLE test.lock_waits (i INT PRIMARY KEY, j INT) ENGINE = InnoDB;
30 LOCK TABLE lock_waits WRITE;
31
32 connection con2;
33 send ALTER TABLE test.lock_waits ADD k VARCHAR(20);
34
35 connection default;
36 while (`SELECT COUNT(*)=0 FROM sys.schema_table_lock_waits`)
37 {
38 --sleep 0.5
39 }
40 SELECT object_schema, object_name,
41 waiting_account, waiting_lock_type, waiting_query,
42 blocking_account, blocking_lock_type, blocking_lock_duration
43 FROM sys.schema_table_lock_waits;
44
45 disconnect con1;
46
47 connection default;
48 while (`SELECT COUNT(*)<> 0 FROM sys.schema_table_lock_waits`)
49 {
50 --sleep 0.5
51 }
52 disconnect con2;
53 connection default;
54
55 DROP TABLE test.lock_waits;