1#
2# Test that $query correctly checks read_only flag even if this
3# flag is set while the query is blocked waiting for protection
4# global read lock. Used by test for bug#28438114 in read_only.test.
5#
6
7--enable_connect_log
8connection default;
9FLUSH TABLES WITH READ LOCK;
10
11connection con1;
12--echo # DDL statement will block waiting for GRL.
13--send_eval $query
14
15connection con2;
16--echo # Wait until statement is blocked waiting for GRL.
17let $wait_condition=
18  SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST
19  WHERE STATE = "Waiting for global read lock";
20--source include/wait_condition.inc
21SET GLOBAL READ_ONLY= 1;
22
23connection default;
24--echo # Unblock the DDL statement.
25UNLOCK TABLES;
26
27connection con1;
28--echo # Without patch for BUG#28438114, the DDL statement will succeed even
29--echo # though read only mode was set.
30--error ER_OPTION_PREVENTS_STATEMENT
31--reap
32
33--echo # Clean up.
34connection default;
35SET GLOBAL READ_ONLY= 0;
36--disable_connect_log
37