mirror of
https://github.com/MariaDB/server.git
synced 2025-01-17 12:32:27 +01:00
BUG#50364: manual merge to mysql-next-mr-bugfixing.
Conflicts ========= Text conflict in sql/repl_failsafe.cc Additional changes ================== Replace references to pthread_mutex with mysql_mutex
This commit is contained in:
commit
6dd801d7b7
6 changed files with 25 additions and 10 deletions
|
@ -382,7 +382,7 @@ let $slave_param_comparison= =;
|
||||||
let $rcvd_heartbeats_before= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1);
|
let $rcvd_heartbeats_before= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1);
|
||||||
# Flush logs every 0.1 second during 5 sec
|
# Flush logs every 0.1 second during 5 sec
|
||||||
--disable_query_log
|
--disable_query_log
|
||||||
let $i=50;
|
let $i=100;
|
||||||
while ($i) {
|
while ($i) {
|
||||||
FLUSH LOGS;
|
FLUSH LOGS;
|
||||||
dec $i;
|
dec $i;
|
||||||
|
|
|
@ -369,7 +369,7 @@ file '%s')", fname);
|
||||||
mi->rli.is_relay_log_recovery= FALSE;
|
mi->rli.is_relay_log_recovery= FALSE;
|
||||||
// now change cache READ -> WRITE - must do this before flush_master_info
|
// now change cache READ -> WRITE - must do this before flush_master_info
|
||||||
reinit_io_cache(&mi->file, WRITE_CACHE, 0L, 0, 1);
|
reinit_io_cache(&mi->file, WRITE_CACHE, 0L, 0, 1);
|
||||||
if ((error=test(flush_master_info(mi, 1))))
|
if ((error=test(flush_master_info(mi, TRUE, TRUE))))
|
||||||
sql_print_error("Failed to flush master info file");
|
sql_print_error("Failed to flush master info file");
|
||||||
mysql_mutex_unlock(&mi->data_lock);
|
mysql_mutex_unlock(&mi->data_lock);
|
||||||
DBUG_RETURN(error);
|
DBUG_RETURN(error);
|
||||||
|
@ -395,7 +395,9 @@ err:
|
||||||
1 - flush master info failed
|
1 - flush master info failed
|
||||||
0 - all ok
|
0 - all ok
|
||||||
*/
|
*/
|
||||||
int flush_master_info(Master_info* mi, bool flush_relay_log_cache)
|
int flush_master_info(Master_info* mi,
|
||||||
|
bool flush_relay_log_cache,
|
||||||
|
bool need_lock_relay_log)
|
||||||
{
|
{
|
||||||
IO_CACHE* file = &mi->file;
|
IO_CACHE* file = &mi->file;
|
||||||
char lbuf[22];
|
char lbuf[22];
|
||||||
|
@ -418,8 +420,19 @@ int flush_master_info(Master_info* mi, bool flush_relay_log_cache)
|
||||||
*/
|
*/
|
||||||
if (flush_relay_log_cache)
|
if (flush_relay_log_cache)
|
||||||
{
|
{
|
||||||
|
mysql_mutex_t *log_lock= mi->rli.relay_log.get_log_lock();
|
||||||
IO_CACHE *log_file= mi->rli.relay_log.get_log_file();
|
IO_CACHE *log_file= mi->rli.relay_log.get_log_file();
|
||||||
if (flush_io_cache(log_file))
|
|
||||||
|
if (need_lock_relay_log)
|
||||||
|
mysql_mutex_lock(log_lock);
|
||||||
|
|
||||||
|
mysql_mutex_assert_owner(log_lock);
|
||||||
|
err= flush_io_cache(log_file);
|
||||||
|
|
||||||
|
if (need_lock_relay_log)
|
||||||
|
mysql_mutex_unlock(log_lock);
|
||||||
|
|
||||||
|
if (err)
|
||||||
DBUG_RETURN(2);
|
DBUG_RETURN(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -119,7 +119,9 @@ int init_master_info(Master_info* mi, const char* master_info_fname,
|
||||||
bool abort_if_no_master_info_file,
|
bool abort_if_no_master_info_file,
|
||||||
int thread_mask);
|
int thread_mask);
|
||||||
void end_master_info(Master_info* mi);
|
void end_master_info(Master_info* mi);
|
||||||
int flush_master_info(Master_info* mi, bool flush_relay_log_cache);
|
int flush_master_info(Master_info* mi,
|
||||||
|
bool flush_relay_log_cache,
|
||||||
|
bool need_lock_relay_log);
|
||||||
int change_master_server_id_cmp(ulong *id1, ulong *id2);
|
int change_master_server_id_cmp(ulong *id1, ulong *id2);
|
||||||
|
|
||||||
#endif /* HAVE_REPLICATION */
|
#endif /* HAVE_REPLICATION */
|
||||||
|
|
|
@ -123,7 +123,7 @@ int init_relay_log_info(Relay_log_info* rli,
|
||||||
/*
|
/*
|
||||||
The relay log will now be opened, as a SEQ_READ_APPEND IO_CACHE.
|
The relay log will now be opened, as a SEQ_READ_APPEND IO_CACHE.
|
||||||
Note that the I/O thread flushes it to disk after writing every
|
Note that the I/O thread flushes it to disk after writing every
|
||||||
event, in flush_master_info(mi, 1).
|
event, in flush_master_info(mi, 1, ?).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -510,7 +510,7 @@ int terminate_slave_threads(Master_info* mi,int thread_mask,bool skip_lock)
|
||||||
DBUG_PRINT("info",("Flushing relay log and master info file."));
|
DBUG_PRINT("info",("Flushing relay log and master info file."));
|
||||||
if (current_thd)
|
if (current_thd)
|
||||||
thd_proc_info(current_thd, "Flushing relay log and master info files.");
|
thd_proc_info(current_thd, "Flushing relay log and master info files.");
|
||||||
if (flush_master_info(mi, TRUE /* flush relay log */))
|
if (flush_master_info(mi, TRUE, FALSE))
|
||||||
DBUG_RETURN(ER_ERROR_DURING_FLUSH_LOGS);
|
DBUG_RETURN(ER_ERROR_DURING_FLUSH_LOGS);
|
||||||
|
|
||||||
if (my_sync(mi->rli.relay_log.get_log_file()->file, MYF(MY_WME)))
|
if (my_sync(mi->rli.relay_log.get_log_file()->file, MYF(MY_WME)))
|
||||||
|
@ -1601,7 +1601,7 @@ static void write_ignored_events_info_to_relay_log(THD *thd, Master_info *mi)
|
||||||
" to the relay log, SHOW SLAVE STATUS may be"
|
" to the relay log, SHOW SLAVE STATUS may be"
|
||||||
" inaccurate");
|
" inaccurate");
|
||||||
rli->relay_log.harvest_bytes_written(&rli->log_space_total);
|
rli->relay_log.harvest_bytes_written(&rli->log_space_total);
|
||||||
if (flush_master_info(mi, 1))
|
if (flush_master_info(mi, TRUE, FALSE))
|
||||||
sql_print_error("Failed to flush master info file");
|
sql_print_error("Failed to flush master info file");
|
||||||
delete ev;
|
delete ev;
|
||||||
}
|
}
|
||||||
|
@ -2928,7 +2928,7 @@ Stopping slave I/O thread due to out-of-memory error from master");
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flush_master_info(mi, 1))
|
if (flush_master_info(mi, TRUE, TRUE))
|
||||||
{
|
{
|
||||||
sql_print_error("Failed to flush master info file");
|
sql_print_error("Failed to flush master info file");
|
||||||
goto err;
|
goto err;
|
||||||
|
|
|
@ -1522,7 +1522,7 @@ bool change_master(THD* thd, Master_info* mi)
|
||||||
Relay log's IO_CACHE may not be inited, if rli->inited==0 (server was never
|
Relay log's IO_CACHE may not be inited, if rli->inited==0 (server was never
|
||||||
a slave before).
|
a slave before).
|
||||||
*/
|
*/
|
||||||
if (flush_master_info(mi, 0))
|
if (flush_master_info(mi, FALSE, FALSE))
|
||||||
{
|
{
|
||||||
my_error(ER_RELAY_LOG_INIT, MYF(0), "Failed to flush master info file");
|
my_error(ER_RELAY_LOG_INIT, MYF(0), "Failed to flush master info file");
|
||||||
ret= TRUE;
|
ret= TRUE;
|
||||||
|
|
Loading…
Reference in a new issue