From b5fcf33d24c90f23ab1302688ff315200807f572 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 7 Jun 2013 14:39:00 +0200 Subject: MDEV-4490: Old-style master position points at the last GTID event after slave restart Now whenever we reach the GTID point requested from the slave (when using GTID position to connect), we send a fake Gtid_list event. This event is used by the slave to know the current old-style position for MASTER_POS_WAIT(), and later the similar binlog position for MASTER_GTID_WAIT(). Without this fake event, if the slave is already fully up-to-date with the master, there may be no events sent at the given position for an indeterminate time. --- sql/slave.cc | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'sql/slave.cc') diff --git a/sql/slave.cc b/sql/slave.cc index 8cb13205f29..1734b2c4f76 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -5071,9 +5071,8 @@ static int queue_event(Master_info* mi,const char* buf, ulong event_len) const char *errmsg; Gtid_list_log_event *glev; Log_event *tmp; + uint32 flags; - if (mi->rli.until_condition != Relay_log_info::UNTIL_GTID) - goto default_action; if (!(tmp= Log_event::read_log_event(buf, event_len, &errmsg, mi->rli.relay_log.description_event_for_queue, opt_slave_sql_verify_checksum))) @@ -5082,16 +5081,8 @@ static int queue_event(Master_info* mi,const char* buf, ulong event_len) goto err; } glev= static_cast(tmp); - if (glev->gl_flags & Gtid_list_log_event::FLAG_UNTIL_REACHED) - { - char str_buf[128]; - String str(str_buf, sizeof(str_buf), system_charset_info); - mi->rli.until_gtid_pos.to_string(&str); - sql_print_information("Slave IO thread stops because it reached its" - " UNTIL master_gtid_pos %s", str.c_ptr_safe()); - mi->abort_slave= true; - } event_pos= glev->log_pos; + flags= glev->gl_flags; delete glev; /* @@ -5105,6 +5096,17 @@ static int queue_event(Master_info* mi,const char* buf, ulong event_len) inc_pos= 0; else inc_pos= event_pos - mi->master_log_pos; + + if (mi->rli.until_condition == Relay_log_info::UNTIL_GTID && + flags & Gtid_list_log_event::FLAG_UNTIL_REACHED) + { + char str_buf[128]; + String str(str_buf, sizeof(str_buf), system_charset_info); + mi->rli.until_gtid_pos.to_string(&str); + sql_print_information("Slave IO thread stops because it reached its" + " UNTIL master_gtid_pos %s", str.c_ptr_safe()); + mi->abort_slave= true; + } } break; -- cgit v1.2.1