MDEV-13915: STOP SLAVE takes very long time on a busy system
The problem is that a parallel replica would not immediately stop
running/queued transactions when issued STOP SLAVE. That is, it
allowed the current group of transactions to run, and sometimes the
transactions which belong to the next group could be started and run
through commit after STOP SLAVE was issued too, if the last group
had started committing. This would lead to long periods to wait for
all waiting transactions to finish.
This patch updates a parallel replica to try and abort immediately
and roll-back any ongoing transactions. The exception to this is any
transactions which are non-transactional (e.g. those modifying
sequences or non-transactional tables), and any prior transactions,
will be run to completion.
The specifics are as follows:
1. A new stage was added to SHOW PROCESSLIST output for the SQL
Thread when it is waiting for a replica thread to either rollback or
finish its transaction before stopping. This stage presents as
“Waiting for worker thread to stop”
2. Worker threads which error or are killed no longer perform GCO
cleanup if there is a concurrently running prior transaction. This
is because a worker thread scheduled to run in a future GCO could be
killed and incorrectly perform cleanup of the active GCO.
3. Refined cases when the FL_TRANSACTIONAL flag is added to GTID
binlog events to disallow adding it to transactions which modify
both transactional and non-transactional engines when the binlogging
configuration allow the modifications to exist in the same event,
i.e. when using binlog_direct_non_trans_update == 0 and
binlog_format == statement.
4. A few existing MTR tests relied on the completion of certain
transactions after issuing STOP SLAVE, and were re-recorded
(potentially with added synchronizations) under the new rollback
behavior.
Reviewed By:
============
Andrei Elkin <email address hidden>
MDEV-30952: Fix shellcheck problems on Debian scripts
Commit fixes several ShellCheck found problems in Debian
Pre- and Postscripts.
Debian script mariadb-server-10.6.postrm contains shellcheck
Fixed problems are:
https://www.shellcheck.net/wiki/SC2166 -- Prefer [ p ] && [ q ] as [ p -a q...
https://www.shellcheck.net/wiki/SC2006 -- Use $(...) notation instead of le...
https://www.shellcheck.net/wiki/SC1091 -- Not following: /usr/share/debconf...
Debian script mariadb-server-10.6.postinst contains shellcheck
Fixed problems are:
https://www.shellcheck.net/wiki/SC2129 -- Consider using { cmd1; cmd2; } >>...
https://www.shellcheck.net/wiki/SC1091 -- Not following: /usr/share/debconf...
https://www.shellcheck.net/wiki/SC1072 -- Expected test to end here (don't ...
https://www.shellcheck.net/wiki/SC1073 -- Couldn't parse this test expressi...
https://www.shellcheck.net/wiki/SC1009 -- The mentioned syntax error was in...
Debian script mariadb-server-10.6.preinst contains shellcheck
Fixed problems are:
https://www.shellcheck.net/wiki/SC2231 -- Quote expansions in this for loop...
https://www.shellcheck.net/wiki/SC2166 -- Prefer [ p ] && [ q ] as [ p -a q...
https://www.shellcheck.net/wiki/SC2001 -- See if you can use ${variable//se...
https://www.shellcheck.net/wiki/SC1091 -- Not following: /usr/share/debconf...
https://www.shellcheck.net/wiki/SC1007 -- Remove space after = if trying to...