summaryrefslogtreecommitdiff
path: root/sql/slave.cc
diff options
context:
space:
mode:
authorunknown <knielsen@knielsen-hq.org>2013-06-07 14:39:00 +0200
committerunknown <knielsen@knielsen-hq.org>2013-06-07 14:39:00 +0200
commitb5fcf33d24c90f23ab1302688ff315200807f572 (patch)
treed7812cea70ce404bfdb46ec7ec68eb3949c5ec03 /sql/slave.cc
parent03aa4876e187fcb7dbae6d43170345d2a25fb0e7 (diff)
downloadmariadb-git-b5fcf33d24c90f23ab1302688ff315200807f572.tar.gz
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.
Diffstat (limited to 'sql/slave.cc')
-rw-r--r--sql/slave.cc24
1 files changed, 13 insertions, 11 deletions
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<Gtid_list_log_event *>(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;