@@ -6723,6 +6723,7 @@ bool MYSQL_BIN_LOG::after_append_to_relay_log(Master_info *mi)
6723
6723
6724
6724
// Check pre-conditions
6725
6725
mysql_mutex_assert_owner (&LOCK_log);
6726
+ mysql_mutex_assert_owner (&mi->data_lock );
6726
6727
DBUG_ASSERT (is_relay_log);
6727
6728
DBUG_ASSERT (current_thd->system_thread == SYSTEM_THREAD_SLAVE_IO);
6728
6729
@@ -6773,22 +6774,7 @@ bool MYSQL_BIN_LOG::after_append_to_relay_log(Master_info *mi)
6773
6774
if ((uint ) my_b_append_tell (&log_file) >
6774
6775
DBUG_EVALUATE_IF (" rotate_slave_debug_group" , 500 , max_size))
6775
6776
{
6776
- /*
6777
- If rotation is required we must acquire data_lock to protect
6778
- description_event from clients executing FLUSH LOGS in parallel.
6779
- In order do that we must release the existing LOCK_log so that we
6780
- get it once again in proper locking order to avoid dead locks.
6781
- i.e data_lock , LOCK_log.
6782
- */
6783
- mysql_mutex_unlock (&LOCK_log);
6784
- mysql_mutex_lock (&mi->data_lock );
6785
- mysql_mutex_lock (&LOCK_log);
6786
6777
error= new_file_without_locking (mi->get_mi_description_event ());
6787
- /*
6788
- After rotation release data_lock, we need the LOCK_log till we signal
6789
- the updation.
6790
- */
6791
- mysql_mutex_unlock (&mi->data_lock );
6792
6778
}
6793
6779
}
6794
6780
@@ -6800,21 +6786,14 @@ bool MYSQL_BIN_LOG::after_append_to_relay_log(Master_info *mi)
6800
6786
6801
6787
bool MYSQL_BIN_LOG::append_event (Log_event* ev, Master_info *mi)
6802
6788
{
6803
- DBUG_ENTER (" MYSQL_BIN_LOG::append_event " );
6789
+ DBUG_ENTER (" MYSQL_BIN_LOG::append " );
6804
6790
6805
- mysql_mutex_assert_owner (&mi->data_lock );
6806
- mysql_mutex_lock (&LOCK_log);
6807
6791
// check preconditions
6808
6792
DBUG_ASSERT (log_file.type == SEQ_READ_APPEND);
6809
6793
DBUG_ASSERT (is_relay_log);
6810
6794
6811
- /*
6812
- Release data_lock by holding LOCK_log, while writing into the relay log.
6813
- If slave IO thread waits here for free space, we don't want
6814
- SHOW SLAVE STATUS to hang on mi->data_lock. Note LOCK_log mutex is
6815
- sufficient to block SQL thread when IO thread is updating relay log here.
6816
- */
6817
- mysql_mutex_unlock (&mi->data_lock );
6795
+ // acquire locks
6796
+ mysql_mutex_lock (&LOCK_log);
6818
6797
6819
6798
// write data
6820
6799
bool error = false ;
@@ -6827,7 +6806,6 @@ bool MYSQL_BIN_LOG::append_event(Log_event* ev, Master_info *mi)
6827
6806
error= true ;
6828
6807
6829
6808
mysql_mutex_unlock (&LOCK_log);
6830
- mysql_mutex_lock (&mi->data_lock );
6831
6809
DBUG_RETURN (error);
6832
6810
}
6833
6811
@@ -6836,25 +6814,11 @@ bool MYSQL_BIN_LOG::append_buffer(const char* buf, uint len, Master_info *mi)
6836
6814
{
6837
6815
DBUG_ENTER (" MYSQL_BIN_LOG::append_buffer" );
6838
6816
6839
- mysql_mutex_assert_owner (&mi->data_lock );
6840
- mysql_mutex_lock (&LOCK_log);
6841
6817
// check preconditions
6842
6818
DBUG_ASSERT (log_file.type == SEQ_READ_APPEND);
6843
6819
DBUG_ASSERT (is_relay_log);
6844
- /*
6845
- Release data_lock by holding LOCK_log, while writing into the relay log.
6846
- If slave IO thread waits here for free space, we don't want
6847
- SHOW SLAVE STATUS to hang on mi->data_lock. Note LOCK_log mutex is
6848
- sufficient to block SQL thread when IO thread is updating relay log here.
6849
- */
6850
- mysql_mutex_unlock (&mi->data_lock );
6851
- DBUG_EXECUTE_IF (" simulate_io_thd_wait_for_disk_space" ,
6852
- {
6853
- const char act[]= " disk_full_reached SIGNAL parked" ;
6854
- DBUG_ASSERT (opt_debug_sync_timeout > 0 );
6855
- DBUG_ASSERT (!debug_sync_set_action (current_thd,
6856
- STRING_WITH_LEN (act)));
6857
- };);
6820
+ mysql_mutex_assert_owner (&LOCK_log);
6821
+
6858
6822
// write data
6859
6823
bool error= false ;
6860
6824
if (my_b_append (&log_file,(uchar*) buf,len) == 0 )
@@ -6865,8 +6829,6 @@ bool MYSQL_BIN_LOG::append_buffer(const char* buf, uint len, Master_info *mi)
6865
6829
else
6866
6830
error= true ;
6867
6831
6868
- mysql_mutex_unlock (&LOCK_log);
6869
- mysql_mutex_lock (&mi->data_lock );
6870
6832
DBUG_RETURN (error);
6871
6833
}
6872
6834
#endif // ifdef HAVE_REPLICATION
0 commit comments