1
# Let's see if FLUSH TABLES WITH READ LOCK can be killed when waiting
2
# for running commits to finish (in the past it could not)
3
# This will not be a meaningful test on non-debug servers so will be
5
# If running mysql-test-run --debug, the --debug added by
6
# mysql-test-run to the mysqld command line will override the one of
7
# -master.opt. But this test is designed to still pass then (though it
8
# won't test anything interesting).
10
# This also won't work with the embedded server test
11
-- source include/not_embedded.inc
13
-- source include/have_debug.inc
15
# Disable concurrent inserts to avoid test failures when reading the
16
# connection id which was inserted into a table by another thread.
17
set @old_concurrent_insert= @@global.concurrent_insert;
18
set @@global.concurrent_insert= 0;
20
connect (con1,localhost,root,,);
21
connect (con2,localhost,root,,);
25
drop table if exists t1;
27
create table t1 (kill_id int);
28
insert into t1 values(connection_id());
30
# Thanks to the parameter we passed to --debug, this FLUSH will
31
# block on a debug build running with our --debug=make_global... It
32
# will block until killed. In other cases (non-debug build or other
33
# --debug) it will succeed immediately
36
send flush tables with read lock;
40
select ((@id := kill_id) - kill_id) from t1;
42
# Wait for the debug sync point, test won't run on non-debug
45
select count(*) = 1 from information_schema.processlist
46
where state = "Waiting for all running commits to finish"
47
and info = "flush tables with read lock";
48
--source include/wait_condition.inc
53
# On debug builds it will be error 1053 (killed); on non-debug, or
54
# debug build running without our --debug=make_global..., will be
55
# error 0 (no error). The only important thing to test is that on
56
# debug builds with our --debug=make_global... we don't hang forever.
64
# Restore global concurrent_insert value
65
set @@global.concurrent_insert= @old_concurrent_insert;