mirror of
https://github.com/MariaDB/server.git
synced 2025-08-26 01:44:06 +03:00
Problem : The basic problem is the way the thread sleeps in mysql-5.5 and also in mysql-5.1 when we execute a stop slave on windows platform. On windows platform if the stop slave is executed after the master dies, we have this long wait before the stop slave return a value. This is because there is a sleep of the thread. The sleep is uninterruptable in the two above version, which was fixed by Davi patch for the BUG#11765860 for mysql-trunk. Backporting his patch for mysql-5.5 fixes the problem. Solution : A new pair of mutex and condition variable is introduced to synchronize thread sleep and finalization. A new mutex is required because the slave threads are terminated while holding the slave thread locks (run_lock), which can not be relinquished during termination as this would affect the lock order.
11 lines
333 B
Plaintext
11 lines
333 B
Plaintext
include/master-slave.inc
|
|
[connection master]
|
|
set @time_before_kill := (select CURRENT_TIMESTAMP);
|
|
[Time before the query]
|
|
[Connection ID of the slave I/O thread found]
|
|
kill <connection_id>;
|
|
set @time_after_kill := (select CURRENT_TIMESTAMP);
|
|
[Time after the query]
|
|
[Killing of the slave IO thread was successful]
|
|
include/rpl_end.inc
|