mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
BUG#35542 Add option to sync master and relay log to disk after every event
BUG#31665 sync_binlog should cause relay logs to be synchronized NOTE: Backporting the patch to next-mr. Add sync_relay_log option to server, this option works for relay log the same as option sync_binlog for binlog. This option also synchronize master info to disk when set to non-zero value. Original patches from Sinisa and Mark, with some modifications
This commit is contained in:
@ -342,6 +342,7 @@ int flush_master_info(Master_info* mi, bool flush_relay_log_cache)
|
||||
{
|
||||
IO_CACHE* file = &mi->file;
|
||||
char lbuf[22];
|
||||
int err= 0;
|
||||
|
||||
DBUG_ENTER("flush_master_info");
|
||||
DBUG_PRINT("enter",("master_pos: %ld", (long) mi->master_log_pos));
|
||||
@ -358,9 +359,17 @@ int flush_master_info(Master_info* mi, bool flush_relay_log_cache)
|
||||
When we come to this place in code, relay log may or not be initialized;
|
||||
the caller is responsible for setting 'flush_relay_log_cache' accordingly.
|
||||
*/
|
||||
if (flush_relay_log_cache &&
|
||||
flush_io_cache(mi->rli.relay_log.get_log_file()))
|
||||
DBUG_RETURN(2);
|
||||
if (flush_relay_log_cache)
|
||||
{
|
||||
IO_CACHE *log_file= mi->rli.relay_log.get_log_file();
|
||||
if (flush_io_cache(log_file))
|
||||
DBUG_RETURN(2);
|
||||
|
||||
/* Sync to disk if --sync-relay-log is set */
|
||||
if (sync_relaylog_period &&
|
||||
my_sync(log_file->file, MY_WME))
|
||||
DBUG_RETURN(2);
|
||||
}
|
||||
|
||||
/*
|
||||
We flushed the relay log BEFORE the master.info file, because if we crash
|
||||
@ -388,7 +397,10 @@ int flush_master_info(Master_info* mi, bool flush_relay_log_cache)
|
||||
mi->password, mi->port, mi->connect_retry,
|
||||
(int)(mi->ssl), mi->ssl_ca, mi->ssl_capath, mi->ssl_cert,
|
||||
mi->ssl_cipher, mi->ssl_key, mi->ssl_verify_server_cert);
|
||||
DBUG_RETURN(-flush_io_cache(file));
|
||||
err= flush_io_cache(file);
|
||||
if (sync_relaylog_period && !err)
|
||||
err= my_sync(mi->fd, MYF(MY_WME));
|
||||
DBUG_RETURN(-err);
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user