mirror of
https://github.com/MariaDB/server.git
synced 2026-05-14 19:07:15 +02:00
BUG#11752315 - 43460: STOP SLAVE UNABLE TO COMPLETE WHEN SLAVE THREAD IS TRYING TO RECONNECT TO
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.
mysql-test/suite/rpl/r/rpl_start_stop_slave.result:
The result file associated with the test added.
mysql-test/suite/rpl/t/rpl_start_stop_slave.test:
A test to check the new functionality.
sql/rpl_mi.cc:
The constructor using the new mutex and condition variables for the master_info.
sql/rpl_mi.h:
The condition variable and mutex have been added for the master_info.
sql/rpl_rli.cc:
The constructor using the new mutex and condition variables for the realy_log_info.
sql/rpl_rli.h:
The condition variable and mutex have been added for the relay_log_info.
sql/slave.cc:
Use a timed wait on a condition variable to implement a interruptible sleep.
The wait is registered with the THD object so that the thread will be woken
up if killed.
This commit is contained in:
parent
31a1f8ef54
commit
e69da6dc3e
9 changed files with 112 additions and 40 deletions
|
|
@ -75,10 +75,12 @@ Relay_log_info::Relay_log_info(bool is_slave_recovery)
|
|||
&data_lock, MY_MUTEX_INIT_FAST);
|
||||
mysql_mutex_init(key_relay_log_info_log_space_lock,
|
||||
&log_space_lock, MY_MUTEX_INIT_FAST);
|
||||
mysql_mutex_init(key_relay_log_info_sleep_lock, &sleep_lock, MY_MUTEX_INIT_FAST);
|
||||
mysql_cond_init(key_relay_log_info_data_cond, &data_cond, NULL);
|
||||
mysql_cond_init(key_relay_log_info_start_cond, &start_cond, NULL);
|
||||
mysql_cond_init(key_relay_log_info_stop_cond, &stop_cond, NULL);
|
||||
mysql_cond_init(key_relay_log_info_log_space_cond, &log_space_cond, NULL);
|
||||
mysql_cond_init(key_relay_log_info_sleep_cond, &sleep_cond, NULL);
|
||||
relay_log.init_pthread_objects();
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
|
@ -91,10 +93,12 @@ Relay_log_info::~Relay_log_info()
|
|||
mysql_mutex_destroy(&run_lock);
|
||||
mysql_mutex_destroy(&data_lock);
|
||||
mysql_mutex_destroy(&log_space_lock);
|
||||
mysql_mutex_destroy(&sleep_lock);
|
||||
mysql_cond_destroy(&data_cond);
|
||||
mysql_cond_destroy(&start_cond);
|
||||
mysql_cond_destroy(&stop_cond);
|
||||
mysql_cond_destroy(&log_space_cond);
|
||||
mysql_cond_destroy(&sleep_cond);
|
||||
relay_log.cleanup();
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue