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";
26
if (`SELECT '$restore_table' <> ''`)
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 = "Locked" and info = "insert into $table (i) values (0)";
47
--source include/wait_condition.inc
52
set debug_sync= 'now SIGNAL go';
61
--echo Success: '$statement' doesn't allow concurrent inserts into '$table'.
65
--echo Error: '$statement' allows concurrent inserts into '$table'!
68
--eval delete from $table where i = 0;
70
if (`SELECT '$restore_table' <> ''`)
72
--eval truncate table $restore_table;
73
--eval insert into $restore_table select * from t_backup;
74
drop temporary table t_backup;
77
# Clean-up. Reset DEBUG_SYNC facility after use.
78
set debug_sync= "RESET";