diff options
author | Kristian Nielsen <knielsen@knielsen-hq.org> | 2016-10-16 23:44:44 +0200 |
---|---|---|
committer | Kristian Nielsen <knielsen@knielsen-hq.org> | 2016-10-16 23:44:44 +0200 |
commit | e1ef99c3dcb8bb6fdea290e319d14f5a983d1785 (patch) | |
tree | 6118948d076e16868b46bc8b14646eee4de610da /sql/log.cc | |
parent | 057c560ee45c61d172ed0ed762b0b33b37349e5c (diff) | |
parent | fb13616518975b84eea9b9e0d5a91122bb1abe7a (diff) | |
download | mariadb-git-e1ef99c3dcb8bb6fdea290e319d14f5a983d1785.tar.gz |
MDEV-7145: Delayed replication
Merge feature into 10.2 from feature branch.
Delayed replication adds an option
CHANGE MASTER TO master_delay=<seconds>
Replication will then delay applying events with that many
seconds. This creates a replication slave that reflects the state of
the master some time in the past.
Feature is ported from MySQL source tree.
Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>
Diffstat (limited to 'sql/log.cc')
-rw-r--r-- | sql/log.cc | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/sql/log.cc b/sql/log.cc index 569942ac485..2c290715741 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -4304,6 +4304,10 @@ void MYSQL_BIN_LOG::wait_for_last_checkpoint_event() relay log. IMPLEMENTATION + + - You must hold rli->data_lock before calling this function, since + it writes group_relay_log_pos and similar fields of + Relay_log_info. - Protects index file with LOCK_index - Delete relevant relay log files - Copy all file names after these ones to the front of the index file @@ -4317,7 +4321,7 @@ void MYSQL_BIN_LOG::wait_for_last_checkpoint_event() read by the SQL slave thread are deleted). @note - - This is only called from the slave-execute thread when it has read + - This is only called from the slave SQL thread when it has read all commands from a relay log and want to switch to a new relay log. - When this happens, we can be in an active transaction as a transaction can span over two relay logs @@ -4348,6 +4352,8 @@ int MYSQL_BIN_LOG::purge_first_log(Relay_log_info* rli, bool included) DBUG_ASSERT(rli->slave_running == MYSQL_SLAVE_RUN_NOT_CONNECT); DBUG_ASSERT(!strcmp(rli->linfo.log_file_name,rli->event_relay_log_name)); + mysql_mutex_assert_owner(&rli->data_lock); + mysql_mutex_lock(&LOCK_index); ir= rli->inuse_relaylog_list; @@ -4406,7 +4412,7 @@ int MYSQL_BIN_LOG::purge_first_log(Relay_log_info* rli, bool included) } /* Store where we are in the new file for the execution thread */ - flush_relay_log_info(rli); + rli->flush(); DBUG_EXECUTE_IF("crash_before_purge_logs", DBUG_SUICIDE();); |