Debian Codegraph @

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

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