mirror of
https://github.com/MariaDB/server.git
synced 2025-07-18 23:03:28 +03:00
MDEV-13915: STOP SLAVE takes very long time on a busy system
At STOP SLAVE, worker threads will continue applying event groups until the end of the current GCO before stopping. This is a left-over from when only conservative mode was available. In optimistic and aggressive mode, often _all_ queued event will be in the same GCO, and slave stop will be needlessly delayed. This patch instead records at STOP SLAVE time the latest (highest sub_id) event group that has started. Then worker threads will continue to apply event groups up to that event group, but skip any following. The result is that each worker thread will complete its currently running event group, and then the slave will stop. If the slave is caught up, and STOP SLAVE is run in the middle of an event group that is already executing in a worker thread, then that event group will be rolled back and the slave stop immediately, as normal. Reviewed-by: Andrei Elkin <andrei.elkin@mariadb.com> Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>
This commit is contained in:
@ -276,13 +276,13 @@ struct rpl_parallel_entry {
|
||||
/*
|
||||
At STOP SLAVE (force_abort=true), we do not want to process all events in
|
||||
the queue (which could unnecessarily delay stop, if a lot of events happen
|
||||
to be queued). The stop_count provides a safe point at which to stop, so
|
||||
to be queued). The stop_sub_id provides a safe point at which to stop, so
|
||||
that everything before becomes committed and nothing after does. The value
|
||||
corresponds to group_commit_orderer::wait_count; if wait_count is less than
|
||||
or equal to stop_count, we execute the associated event group, else we
|
||||
skip it (and all following) and stop.
|
||||
corresponds to rpl_group_info::gtid_sub_id; if that is less than or equal
|
||||
to stop_sub_id, we execute the associated event group, else we skip it (and
|
||||
all following) and stop.
|
||||
*/
|
||||
uint64 stop_count;
|
||||
uint64 stop_sub_id;
|
||||
|
||||
/*
|
||||
Cyclic array recording the last rpl_thread_max worker threads that we
|
||||
|
Reference in New Issue
Block a user