File: idx_compare_metadata_locks.test

package info (click to toggle)
mysql-8.0 8.0.43-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,273,924 kB
  • sloc: cpp: 4,684,605; ansic: 412,450; pascal: 108,398; java: 83,641; perl: 30,221; cs: 27,067; sql: 26,594; sh: 24,181; python: 21,816; yacc: 17,169; php: 11,522; xml: 7,388; javascript: 7,076; makefile: 2,194; lex: 1,075; awk: 670; asm: 520; objc: 183; ruby: 97; lisp: 86
file content (94 lines) | stat: -rw-r--r-- 2,230 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#
# Verify that query results are the same with and without indexes.
#
--source include/have_debug_sync.inc
--source include/have_debug.inc

--echo # Prevent background threads to acquire mdl locks, which
--echo # the result unstable
SET GLOBAL innodb_fast_shutdown=0;
let $restart_parameters = restart: --debug=d,do_not_meta_lock_in_background;
--source include/restart_mysqld.inc

let $table = "metadata_locks";
let $target_type  = TABLE;
let $target_schema = test;
let $target_name  = t1;

--echo TABLE: $table
--echo INDEXES: PK (OBJECT_INSTANCE_BEGIN), KEY (OBJECT_TYPE, OBJECT_SCHEMA, OBJECT_NAME), KEY (OWNER_THREAD_ID, OWNER_EVENT_ID)

--source ../include/idx_compare_setup.inc

--disable_query_log

# Get an object_instance_begin

--connection con1
# Get MDL read lock
LOCK TABLE t1 READ;

--connection con2

# User1 has a READ LOCK
# User2 waiting for WRITE LOCK
--send LOCK TABLE t1 write;

--connection default

# Wait for the LOCK TABLE t1 write to block
let $wait_condition=
  select count(*) = 1 from performance_schema.events_waits_current
  where event_name = 'wait/lock/metadata/sql/mdl'
  and object_name = 't1';
--source include/wait_condition.inc

--connection default

eval SELECT object_instance_begin, owner_event_id
  INTO @object_instance_begin, @target_event_id
  FROM performance_schema.metadata_locks
  WHERE lock_type = 'SHARED_READ_ONLY'
    AND owner_thread_id = $con1_thread_id
  LIMIT 1;

--enable_query_log

#DEBUG SELECT @object_instance_begin, @owner_event_id;

--echo
--echo ## Test OBJECT_INSTANCE_BEGIN
let $key_group = 12;
--source ../include/idx_compare_load.inc

--echo
--echo ## Test OBJECT_TYPE, OBJECT_SCHEMA, OBJECT_NAME
let $key_group = 10;
--source ../include/idx_compare_load.inc

--echo
--echo ## Test OWNER_THREAD_ID, OWNER_EVENT_ID
--disable_query_log
eval SET @target_thread_id = $con1_thread_id;
--enable_query_log
let $key_group = 1.1;
--source ../include/idx_compare_load.inc

--connection con1

# User1 releases a READ LOCK
# User2 granted a WRITE LOCK
UNLOCK TABLES;

--connection con2

# Complete LOCK TABLE t1 write
--reap
UNLOCK TABLES;

--connection default

--source ../include/idx_compare_cleanup.inc

let $restart_parameters =;
--source include/restart_mysqld.inc