mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Making FLUSH TABLES WITH READ LOCK killable while it's waiting for running commits to finish. Normally this step is not long but it's still nice to be killable
(especially in case of bug like BUG#6732 "FLUSH TABLES WITH READ LOCK + COMMIT makes next FLUSH...LOCK hang forever"). sql/lock.cc: making FLUSH TABLES WITH READ LOCK killable while it's waiting for running commits to finish sql/mysql_priv.h: prototype change sql/sql_parse.cc: now it's possible that make_global_read_lock_block_commit fails (killed)
This commit is contained in:
9
mysql-test/r/flush_read_lock_kill.result
Normal file
9
mysql-test/r/flush_read_lock_kill.result
Normal file
@ -0,0 +1,9 @@
|
||||
drop table if exists t1;
|
||||
create table t1 (kill_id int);
|
||||
insert into t1 values(connection_id());
|
||||
flush tables with read lock;
|
||||
select ((@id := kill_id) - kill_id) from t1;
|
||||
((@id := kill_id) - kill_id)
|
||||
0
|
||||
kill connection @id;
|
||||
drop table t1;
|
1
mysql-test/t/flush_read_lock_kill-master.opt
Normal file
1
mysql-test/t/flush_read_lock_kill-master.opt
Normal file
@ -0,0 +1 @@
|
||||
--debug=d,make_global_read_lock_block_commit_loop
|
46
mysql-test/t/flush_read_lock_kill.test
Normal file
46
mysql-test/t/flush_read_lock_kill.test
Normal file
@ -0,0 +1,46 @@
|
||||
# Let's see if FLUSH TABLES WITH READ LOCK can be killed when waiting
|
||||
# for running commits to finish (in the past it could not)
|
||||
# This will not be a meaningful test on non-debug servers so will be
|
||||
# skipped.
|
||||
# If running mysql-test-run --debug, the --debug added by
|
||||
# mysql-test-run to the mysqld command line will override the one of
|
||||
# -master.opt. But this test is designed to still pass then (though it
|
||||
# won't test anything interesting).
|
||||
|
||||
-- source include/have_debug.inc
|
||||
|
||||
connect (con1,localhost,root,,);
|
||||
connect (con2,localhost,root,,);
|
||||
connection con1;
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
create table t1 (kill_id int);
|
||||
insert into t1 values(connection_id());
|
||||
|
||||
# Thanks to the parameter we passed to --debug, this FLUSH will
|
||||
# block on a debug build running with our --debug=make_global... It
|
||||
# will block until killed. In other cases (non-debug build or other
|
||||
# --debug) it will succeed immediately
|
||||
|
||||
connection con1;
|
||||
send flush tables with read lock;
|
||||
|
||||
# kill con1
|
||||
connection con2;
|
||||
select ((@id := kill_id) - kill_id) from t1;
|
||||
|
||||
--sleep 2; # leave time for FLUSH to block
|
||||
kill connection @id;
|
||||
|
||||
connection con1;
|
||||
# On debug builds it will be error 1053 (killed); on non-debug, or
|
||||
# debug build running without our --debug=make_global..., will be
|
||||
# error 0 (no error). The only important thing to test is that on
|
||||
# debug builds with our --debug=make_global... we don't hang forever.
|
||||
--error 0,1053
|
||||
reap;
|
||||
|
||||
connection con2;
|
||||
drop table t1;
|
Reference in New Issue
Block a user