1
by brian
clean slate |
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
|
|
4 |
# skipped.
|
|
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). |
|
9 |
||
10 |
-- source include/have_debug.inc |
|
11 |
||
12 |
# Disable concurrent inserts to avoid test failures when reading the |
|
13 |
# connection id which was inserted into a table by another thread. |
|
14 |
set @old_concurrent_insert= @@global.concurrent_insert; |
|
15 |
set @@global.concurrent_insert= 0; |
|
16 |
||
17 |
connect (con1,localhost,root,,); |
|
18 |
connect (con2,localhost,root,,); |
|
19 |
connection con1; |
|
20 |
||
21 |
--disable_warnings |
|
22 |
drop table if exists t1; |
|
23 |
--enable_warnings |
|
24 |
create table t1 (kill_id int); |
|
25 |
insert into t1 values(connection_id()); |
|
26 |
||
27 |
# Thanks to the parameter we passed to --debug, this FLUSH will |
|
28 |
# block on a debug build running with our --debug=make_global... It |
|
29 |
# will block until killed. In other cases (non-debug build or other |
|
30 |
# --debug) it will succeed immediately |
|
31 |
||
32 |
connection con1; |
|
33 |
send flush tables with read lock; |
|
34 |
||
35 |
# kill con1 |
|
36 |
connection con2; |
|
37 |
select ((@id := kill_id) - kill_id) from t1; |
|
38 |
||
39 |
# Wait for the debug sync point, test won't run on non-debug |
|
40 |
# builds anyway.
|
|
41 |
let $wait_condition=
|
|
42 |
select count(*) = 1 from information_schema.processlist
|
|
43 |
where state = "Waiting for all running commits to finish"
|
|
44 |
and info = "flush tables with read lock";
|
|
45 |
--source include/wait_condition.inc
|
|
46 |
||
47 |
kill connection @id;
|
|
48 |
||
49 |
connection con1;
|
|
50 |
# On debug builds it will be error 1053 (killed); on non-debug, or
|
|
51 |
# debug build running without our --debug=make_global..., will be
|
|
52 |
# error 0 (no error). The only important thing to test is that on
|
|
53 |
# debug builds with our --debug=make_global... we don't hang forever. |
|
54 |
--error 0,1053,2013 |
|
55 |
reap; |
|
56 |
||
57 |
connection con2; |
|
58 |
drop table t1; |
|
59 |
connection default; |
|
60 |
||
61 |
# Restore global concurrent_insert value |
|
62 |
set @@global.concurrent_insert= @old_concurrent_insert; |