Debian Codegraph @

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

raw
1 # Performance schema tests, for SX-lock
2 # Note that only Innodb provides instrumented SX-locks,
3 # so this test depends largely on the innodb instrumentation.
4
5 --source include/not_embedded.inc
6 --source include/have_perfschema.inc
7 --source include/have_innodb.inc
8
9 UPDATE performance_schema.setup_instruments SET enabled = 'NO', timed = 'YES';
10
11 UPDATE performance_schema.setup_instruments SET enabled = 'YES'
12 WHERE name like 'wait/synch/sxlock/%';
13
14 UPDATE performance_schema.setup_instruments SET enabled = 'YES'
15 WHERE name like 'wait/synch/rwlock/innodb/%';
16
17 SELECT DISTINCT name FROM performance_schema.setup_instruments
18 WHERE name LIKE 'wait/synch/rwlock/innodb/%'
19 AND name!='wait/synch/rwlock/innodb/btr_search_latch' ORDER BY name;
20
21 TRUNCATE TABLE performance_schema.events_waits_history_long;
22 TRUNCATE TABLE performance_schema.events_waits_history;
23 TRUNCATE TABLE performance_schema.events_waits_current;
24
25 # Check some SX-locks classes are instrumented
26 select name from performance_schema.setup_instruments
27 where name like "wait/synch/sxlock/%" order by name;
28
29 # Check some SX-locks instances are instrumented
30 SELECT DISTINCT name FROM performance_schema.rwlock_instances
31 WHERE name LIKE 'wait/synch/sxlock/innodb/%'
32 ORDER BY name;
33
34 # Some Innodb payload, to produce data
35
36 create table t1(a int) engine=innodb;
37 begin;
38 insert into t1 values (1), (2), (3);
39 insert into t1 values (1), (2), (3);
40 insert into t1 values (1), (2), (3);
41 commit;
42 drop table t1;
43
44 # Make sure some rw-lock operations have been executed
45 # (there will only occasionally be waits on some rw-locks)
46
47 SELECT DISTINCT event_name FROM performance_schema.events_waits_history_long
48 WHERE event_name LIKE 'wait/synch/rwlock/innodb/%'
49 AND event_name NOT IN
50 ('wait/synch/rwlock/innodb/btr_search_latch',
51 'wait/synch/rwlock/innodb/dict_operation_lock',
52 'wait/synch/rwlock/innodb/trx_rseg_latch',
53 'wait/synch/rwlock/innodb/trx_purge_latch')
54 ORDER BY event_name;
55
56 # Make sure some shared_lock operations have been executed
57
58 SELECT event_name FROM performance_schema.events_waits_history_long
59 WHERE event_name = 'wait/synch/sxlock/innodb/index_tree_rw_lock'
60 AND operation IN ('try_shared_lock','shared_lock') LIMIT 1;
61
62 # Make sure some exclusive_lock operations have been executed
63
64 SELECT event_name from performance_schema.events_waits_history_long
65 WHERE event_name = 'wait/synch/sxlock/innodb/index_tree_rw_lock'
66 AND operation IN ('try_exclusive_lock','exclusive_lock') LIMIT 1;
67
68 # Cleanup
69
70 UPDATE performance_schema.setup_instruments SET enabled = 'YES', timed = 'YES';