diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 18:00:34 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 18:00:34 +0000 |
commit | 3f619478f796eddbba6e39502fe941b285dd97b1 (patch) | |
tree | e2c7b5777f728320e5b5542b6213fd3591ba51e2 /mysql-test/include/kill_binlog_dump_threads.inc | |
parent | Initial commit. (diff) | |
download | mariadb-3f619478f796eddbba6e39502fe941b285dd97b1.tar.xz mariadb-3f619478f796eddbba6e39502fe941b285dd97b1.zip |
Adding upstream version 1:10.11.6.upstream/1%10.11.6upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'mysql-test/include/kill_binlog_dump_threads.inc')
-rw-r--r-- | mysql-test/include/kill_binlog_dump_threads.inc | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/mysql-test/include/kill_binlog_dump_threads.inc b/mysql-test/include/kill_binlog_dump_threads.inc new file mode 100644 index 00000000..38e3e2a7 --- /dev/null +++ b/mysql-test/include/kill_binlog_dump_threads.inc @@ -0,0 +1,62 @@ +# ==== Purpose ==== +# +# Terminate all binlog dump threads on a master. +# +# This is sometimes useful, as normally such dump threads can hang +# around for some time before they notice that the slave has disconnected. +# +# Note that if there are active slave connections, they might try to +# reconnect as their dump threads are killed, which may not lead to the +# desired results. +# +# +# ==== Usage ==== +# +# [--let $kill_timeout= NUMBER] +# --source include/stop_slavekill_binlog_dump_threads.inc +# +# Parameters: +# $kill_timeout +# Maximum number of seconds to wait for dump threads to disappear. + + +--let $include_filename= kill_binlog_dump_threads.inc +--source include/begin_include_file.inc + +--disable_query_log + +let $wait_counter= 300; +if ($kill_timeout) +{ + let $wait_counter= `SELECT $kill_timeout * 10`; +} + +let $success= 0; +while ($wait_counter) +{ + dec $wait_counter; + let $_tid= `SELECT id FROM information_schema.processlist WHERE command = 'Binlog Dump' LIMIT 1`; + if ($_tid) + { + eval KILL QUERY $_tid; + } + if (!$_tid) + { + let $wait_counter= 0; + let $success= 1; + } + if (!$success) + { + real_sleep 0.1; + } +} +if (!$success) +{ + SHOW FULL PROCESSLIST; + --die Timeout while waiting for binlog dump threads to disappear. +} + +--enable_query_log + +--let $include_filename= kill_binlog_dump_threads.inc +--source include/end_include_file.inc |