3 # Check that statement reading table '$table' doesn't allow concurrent
7 # $table Table in which concurrent inserts should be disallowed.
8 # $con_aux1 Name of the first auxiliary connection to be used by this
10 # $con_aux2 Name of the second auxiliary connection to be used by this
12 # $statement Statement to be checked.
13 # $restore_table Table which might be modified by statement to be checked
14 # and thus needs backing up before its execution and
15 # restoring after it (can be empty).
23 # Reset DEBUG_SYNC facility for safety.
24 set debug_sync=
"RESET";
28 --eval create temporary
table t_backup select * from $restore_table;
32 set debug_sync=
'after_lock_tables_takes_lock SIGNAL parked WAIT_FOR go';
33 --send_eval $statement;
36 set debug_sync=
'now WAIT_FOR parked';
37 --send_eval insert into $table (
i) values (0);
42 # Wait until concurrent insert is successfully blocked because
45 select count(*) = 1 from information_schema.processlist
46 where state =
"Waiting for table level lock" and
47 info =
"insert into $table (i) values (0)";
48 --source include/wait_condition.inc
53 set debug_sync=
'now SIGNAL go';
62 --echo Success:
'$statement' doesn
't allow concurrent inserts into '$table
'.
66 --echo Error: '$statement
' allows concurrent inserts into '$table
'!
69 --eval delete from $table where i = 0;
73 --eval truncate table $restore_table;
74 --eval insert into $restore_table select * from t_backup;
75 drop temporary table t_backup;
78 # Clean-up. Reset DEBUG_SYNC facility after use.
79 set debug_sync= "RESET";