mirror of
https://github.com/MariaDB/server.git
synced 2025-01-19 13:32:33 +01:00
22e793639a
- If USER is given, all threads for that user is signaled - If SOFT is used then the KILL will not be sent to the handler. This can be used to not interrupt critical things in the handler like 'REPAIR'. Internally added more kill signals. This gives us more information of why a query/connection was killed. - KILL_SERVER is used when server is going down. In this case the users gets ER_SHUTDOWN as the reason connection was killed. - Changed signals to number in correct order, which makes it easier to test how the signal should affect the code. - New error message ER_CONNECTION_KILLED if connection was killed by 'KILL CONNECTION'. Before we got error ER_SHUTDOWN. Changed names of not used parameters KILL_QUERY & KILL_CONNCTION to mysql_kill() to not conflict with defines in the server include/mysql.h.pp: Updated file include/mysql_com.h: Changed names of not used parameters KILL_QUERY & KILL_CONNCTION to mysql_kill() to not conflict with defines in the server mysql-test/r/kill.result: Added test of KILL USER mysql-test/suite/rpl/r/rpl_stm_000001.result: Updated error code mysql-test/suite/rpl/t/rpl_stm_000001.test: Updated error codes mysql-test/t/flush_read_lock_kill.test: Updated error codes mysql-test/t/kill.test: Added test of KILL USER plugin/handler_socket/handlersocket/database.cpp: Removed THD:: from KILL sql/debug_sync.cc: Removed THD:: from KILL sql/event_scheduler.cc: Removed THD:: from KILL sql/filesort.cc: Removed THD:: from KILL sql/ha_ndbcluster_binlog.cc: Removed THD:: from KILL sql/handler.cc: Removed THD:: from KILL Simplify code. sql/lex.h: Added new keywords HARD | SOFT sql/log.cc: Removed THD:: from KILL Added testing of new error ER_CONNECTION_KILLED sql/log_event.cc: Removed THD:: from KILL Added testing of new error ER_CONNECTION_KILLED sql/mysql_priv.h: Added new prototypes sql/mysqld.cc: Removed THD:: from KILL Use KILL_SERVER_HARD signal on shutdown. sql/scheduler.cc: Removed THD:: from KILL Simplify test if connection should be killed sql/share/errmsg.txt: New error message ER_CONNECTION_KILLED sql/slave.cc: Removed THD:: from KILL sql/sp_head.cc: Removed THD:: from KILL sql/sql_base.cc: Removed THD:: from KILL sql/sql_cache.cc: Removed THD:: from KILL sql/sql_class.cc: Removed THD:: from KILL Added killed_errno() Only signal kill to storage engine if HARD bit is set. sql/sql_class.h: Move KILL options out from THD to make them easier to use in sql_yacc.yy sql/sql_connect.cc: Removed THD:: from KILL sql/sql_delete.cc: Removed THD:: from KILL sql/sql_error.cc: Removed THD:: from KILL sql/sql_insert.cc: Removed THD:: from KILL Simplifed testing if thread is killed. sql/sql_lex.h: Added kill options to st_lex sql/sql_load.cc: Removed THD:: from KILL sql/sql_parse.cc: Added kill options to st_lex Simplifed and optimzed testing of thd->killed at end of query Added support for KILL USER Extended sql_kill() to allow use of more kill signals. sql/sql_repl.cc: Removed THD:: from KILL sql/sql_show.cc: Removed THD:: from KILL Simplied testing if query/connection was killed sql/sql_table.cc: Removed THD:: from KILL sql/sql_update.cc: Removed THD:: from KILL sql/sql_yacc.yy: Added support for new KILL syntax: KILL [HARD|SOFT] [CONNECTION|QUERY] [ID | USER user_name] storage/archive/ha_archive.cc: Simplify compilation storage/maria/ha_maria.cc: Removed THD:: from KILL
74 lines
2.3 KiB
Text
74 lines
2.3 KiB
Text
# 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).
|
|
|
|
# This also won't work with the embedded server test
|
|
--source include/not_embedded.inc
|
|
|
|
--source include/have_debug.inc
|
|
|
|
# Save the initial number of concurrent sessions
|
|
--source include/count_sessions.inc
|
|
|
|
# Disable concurrent inserts to avoid test failures when reading the
|
|
# connection id which was inserted into a table by another thread.
|
|
SET @old_concurrent_insert= @@global.concurrent_insert;
|
|
SET @@global.concurrent_insert= 0;
|
|
|
|
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;
|
|
|
|
# Wait for the debug sync point, test won't run on non-debug
|
|
# builds anyway.
|
|
let $wait_condition=
|
|
select count(*) = 1 from information_schema.processlist
|
|
where state = "Waiting for all running commits to finish"
|
|
and info = "flush tables with read lock";
|
|
--source include/wait_condition.inc
|
|
|
|
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,ER_CONNECTION_KILLED,2013
|
|
reap;
|
|
|
|
connection con2;
|
|
DROP TABLE t1;
|
|
|
|
connection default;
|
|
disconnect con2;
|
|
|
|
# Restore global concurrent_insert value
|
|
SET @@global.concurrent_insert= @old_concurrent_insert;
|
|
|
|
# Wait till all disconnects are completed
|
|
--source include/wait_until_count_sessions.inc
|
|
|