File: global_read_lock.test

package info (click to toggle)
mysql-5.5 5.5.60-0%2Bdeb8u1
  • links: PTS, VCS
  • area: main
  • in suites: jessie
  • size: 201,012 kB
  • sloc: cpp: 648,063; ansic: 552,041; perl: 48,017; pascal: 25,099; sh: 15,065; yacc: 13,088; cs: 4,647; xml: 4,178; sql: 3,380; makefile: 1,368; lex: 639; awk: 54
file content (80 lines) | stat: -rw-r--r-- 2,177 bytes parent folder | download | duplicates (6)
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
# Tests for PERFORMANCE_SCHEMA
#
# Test the effect of a flush tables with read lock on setup_ tables.

--source include/not_embedded.inc
--source include/have_perfschema.inc

use performance_schema;

# Make test robust against errors in other tests.
# Ensure that instrumentation is turned on when we create new connection.
update performance_schema.setup_instruments set enabled='YES';

grant SELECT, UPDATE, LOCK TABLES on performance_schema.* to pfsuser@localhost;
flush privileges;

--echo connect (con1, localhost, pfsuser, , test);
connect (con1, localhost, pfsuser, , test);

lock tables performance_schema.setup_instruments read;
--disable_result_log
select * from performance_schema.setup_instruments;
--enable_result_log
unlock tables;

lock tables performance_schema.setup_instruments write;
update performance_schema.setup_instruments set enabled='NO';
update performance_schema.setup_instruments set enabled='YES';
unlock tables;

--echo connection default;
connection default;

flush tables with read lock;

--echo connection con1;
connection con1;

lock tables performance_schema.setup_instruments read;
--disable_result_log
select * from performance_schema.setup_instruments;
--enable_result_log
unlock tables;

# This will block
--send
lock tables performance_schema.setup_instruments write;

--echo connection default;
connection default;

let $wait_condition= select 1 from performance_schema.events_waits_current where event_name like "wait/synch/cond/sql/MDL_context::COND_wait_status";

--source include/wait_condition.inc

# Observe the blocked thread in the performance schema :)
select event_name,
  left(source, locate(":", source)) as short_source,
  timer_end, timer_wait, operation
  from performance_schema.events_waits_current
  where event_name like "wait/synch/cond/sql/MDL_context::COND_wait_status";

unlock tables;

connection con1;
--reap

update performance_schema.setup_instruments set enabled='NO';
update performance_schema.setup_instruments set enabled='YES';
unlock tables;

disconnect con1;
--source include/wait_until_disconnected.inc

--echo connection default;
connection default;

drop user pfsuser@localhost;
flush privileges;