Debian Codegraph @

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

raw
1 #
2 # Verify that query results are the same with and without indexes.
3 #
4 --source include/have_debug_sync.inc
5
6 let $table = "mutex_instances";
7 let $name_column = NAME;
8 let $target_name = wait/synch/mutex/sql/MDL_wait::LOCK_wait_status;
9 let $id_column = LOCKED_BY_THREAD_ID;
10
11 --echo TABLE: $table
12 --echo INDEXES: PK (OBJECT_INSTANCE_BEGIN), KEY (NAME), KEY (LOCKED_BY_THREAD_ID)
13
14 --source ../include/idx_compare_setup.inc
15
16 --disable_query_log
17
18 # Get an object_instance_begin, mutex_name and locked_by_thread_id
19
20 --connection con1
21 # Get MDL read lock
22 LOCK TABLE t1 READ;
23
24 --connection con2
25
26 # User1 has a READ LOCK
27 # User2 waiting for WRITE LOCK
28 --send LOCK TABLE t1 write;
29
30 --connection default
31
32 # Wait for the LOCK TABLE t1 write to block
33 let $wait_condition=
34 select count(*) = 1 from performance_schema.events_waits_current
35 where event_name = 'wait/lock/metadata/sql/mdl'
36 and object_name = 't1';
37 --source include/wait_condition.inc
38
39 --connection default
40
41 eval SELECT object_instance_begin, locked_by_thread_id
42 INTO @object_instance_begin, @target_id
43 FROM performance_schema.mutex_instances
44 WHERE name = 'wait/synch/mutex/sql/MDL_wait::LOCK_wait_status'
45 AND locked_by_thread_id IS NOT NULL LIMIT 1;
46
47 UPDATE performance_schema.threads SET instrumented = 'NO';
48
49 --enable_query_log
50
51 #DEBUG SELECT @object_instance_begin, @target_thread_id;
52
53 --echo
54 --echo ## Test OBJECT_INSTANCE_BEGIN
55 let $key_group = 12;
56 --source ../include/idx_compare_load.inc
57
58 --echo
59 --echo ## Test NAME
60 let $key_group = 13;
61 --source ../include/idx_compare_load.inc
62
63 --echo
64 --echo ## Test LOCKED_BY_THREAD_ID
65 let $key_group = 14;
66 --source ../include/idx_compare_load.inc
67
68 --connection con1
69
70 # User1 releases a READ LOCK
71 # User2 granted a WRITE LOCK
72 UNLOCK TABLES;
73
74 --connection con2
75
76 # Complete LOCK TABLE t1 write
77 --reap
78 UNLOCK TABLES;
79
80 --connection default
81
82 --source ../include/idx_compare_cleanup.inc