| 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 |
UPDATE performance_schema.setup_instruments SET enabled = 'NO', timed = 'YES'; |
| 6 |
|
| 7 |
UPDATE performance_schema.setup_instruments SET enabled = 'YES' |
| 8 |
WHERE name like 'wait/synch/sxlock/%'; |
| 9 |
|
| 10 |
TRUNCATE TABLE performance_schema.events_waits_history_long; |
| 11 |
TRUNCATE TABLE performance_schema.events_waits_history; |
| 12 |
TRUNCATE TABLE performance_schema.events_waits_current; |
| 13 |
|
| 14 |
# Check some SX-locks classes are instrumented |
| 15 |
# (exclude instruments that depend on compiling options) |
| 16 |
select name from performance_schema.setup_instruments |
| 17 |
where name like "wait/synch/sxlock/%" |
| 18 |
and name not in |
| 19 |
("wait/synch/sxlock/innodb/buf_block_lock", |
| 20 |
"wait/synch/sxlock/innodb/buf_block_debug_latch") |
| 21 |
order by name; |
| 22 |
|
| 23 |
# Check some SX-locks instances are instrumented |
| 24 |
select name from performance_schema.rwlock_instances |
| 25 |
where name in |
| 26 |
( |
| 27 |
'wait/synch/sxlock/innodb/btr_search_latch', |
| 28 |
'wait/synch/sxlock/innodb/checkpoint_lock', |
| 29 |
'wait/synch/sxlock/innodb/dict_operation_lock', |
| 30 |
'wait/synch/sxlock/innodb/trx_i_s_cache_lock', |
| 31 |
'wait/synch/sxlock/innodb/trx_purge_latch' |
| 32 |
) |
| 33 |
order by name; |
| 34 |
|
| 35 |
# Some Innodb payload, to produce data |
| 36 |
|
| 37 |
--disable_warnings |
| 38 |
drop table if exists t1; |
| 39 |
--enable_warnings |
| 40 |
|
| 41 |
create table t1(a int) engine=innodb; |
| 42 |
begin; |
| 43 |
insert into t1 values (1), (2), (3); |
| 44 |
insert into t1 values (1), (2), (3); |
| 45 |
insert into t1 values (1), (2), (3); |
| 46 |
commit; |
| 47 |
drop table t1; |
| 48 |
|
| 49 |
# Make sure some shared_lock operations have been executed |
| 50 |
|
| 51 |
select operation from performance_schema.events_waits_history_long |
| 52 |
where event_name like "wait/synch/sxlock/%" |
| 53 |
and operation = "shared_lock" limit 1; |
| 54 |
|
| 55 |
# Make sure some exclusive_lock operations have been executed |
| 56 |
|
| 57 |
select operation from performance_schema.events_waits_history_long |
| 58 |
where event_name like "wait/synch/sxlock/%" |
| 59 |
and operation = "exclusive_lock" limit 1; |
| 60 |
|
| 61 |
# The following operations are not verified in this test: |
| 62 |
# - shared_exclusive_lock |
| 63 |
# - try_shared_lock |
| 64 |
# - try_shared_exclusive_lock |
| 65 |
# - try_exclusive_lock |
| 66 |
# because to observe them: |
| 67 |
# - there must be an actual code path using the operation |
| 68 |
# (this affects try operations, which are not all used) |
| 69 |
# - there must be a repeatable scenario to trigger the |
| 70 |
# code path, to use as payload in the test script |
| 71 |
|
| 72 |
# Cleanup |
| 73 |
|
| 74 |
|
| 75 |
UPDATE performance_schema.setup_instruments SET enabled = 'YES', timed = 'YES'; |
| 76 |
|