3 # Check that a statement is incompatible with FLUSH TABLES WITH READ LOCK.
6 # $con_aux1 Name of the 1st aux connection to be used by this script.
7 # $con_aux2 Name of the 2nd aux connection to be used by this script.
8 # $statement The statement to be checked.
9 # $cleanup_stmt1 The 1st statement to be run in order to revert effects
10 # of statement to be checked.
11 # $cleanup_stmt2 The 2nd statement to be run in order to revert effects
12 # of statement to be checked.
13 # $skip_3rd_chk Skip the 3rd stage of checking. The purpose of the third
14 # stage is to check that metadata locks taken by this
15 # statement are incompatible with metadata locks taken
19 # flush_read_lock.test
24 # Reset DEBUG_SYNC facility for safety.
25 set debug_sync=
"RESET";
28 # First, check that the statement cannot be run under FTWRL.
30 flush tables with read lock;
31 --disable_abort_on_error
33 --enable_abort_on_error
34 let $err= $mysql_errno;
37 --echo Success: Was not able
to run '$statement' under FTWRL.
42 --echo Error: Was able
to run '$statement' under FTWRL!
46 --eval $cleanup_stmt1;
50 --eval $cleanup_stmt2;
56 # Then check that this statement is blocked by FTWRL
57 # that is active in another connection.
60 flush tables with read lock;
63 --send_eval $statement;
70 select count(*) = 1 from information_schema.processlist
71 where (state =
"Waiting for global read lock" or
72 state =
"Waiting for commit lock") and
74 --source include/wait_condition.inc
80 --echo Success:
'$statement' is blocked by FTWRL active in another connection.
84 --echo Error:
'$statement' wasn
't blocked by FTWRL active in another connection!
93 --eval $cleanup_stmt1;
97 --eval $cleanup_stmt2;
100 if (!$skip_3rd_check)
103 # Finally, let us check that FTWRL will not succeed if this
104 # statement is active but has already closed its tables.
107 --eval set debug_sync='execute_command_after_close_tables SIGNAL parked WAIT_FOR go
';
108 --send_eval $statement;
110 connection $con_aux1;
111 set debug_sync="now WAIT_FOR parked";
112 --send flush tables with read lock
114 connection $con_aux2;
118 select count(*) = 1 from information_schema.processlist
119 where (state = "Waiting for global read lock" or
120 state = "Waiting for commit lock") and
121 info = "flush tables with read lock";
122 --source include/wait_condition.inc
128 --echo Success: FTWRL is blocked when '$statement
' is active in another connection.
132 --echo Error: FTWRL isn't blocked when
'$statement' is active in another connection!
134 set debug_sync=
"now SIGNAL go";
137 connection $con_aux1;
142 set debug_sync=
"RESET";
146 --eval $cleanup_stmt1;
150 --eval $cleanup_stmt2;