diff options
author | unknown <knielsen@knielsen-hq.org> | 2013-01-25 15:21:49 +0100 |
---|---|---|
committer | unknown <knielsen@knielsen-hq.org> | 2013-01-25 15:21:49 +0100 |
commit | 1d35777647a809992d5305dc7f3082ee801fa28a (patch) | |
tree | 3f63daca124842ab66a71fc43a4a126d1b57e158 /sql/slave.cc | |
parent | 0b36233acd53299f8721d9229698e97b72c90d93 (diff) | |
download | mariadb-git-1d35777647a809992d5305dc7f3082ee801fa28a.tar.gz |
MDEV-26: Global transaction ID.
When starting slave, check binlog state in addition to mysql.rpl_slave.state.
This allows to switch a previous master to be a slave directly
with MASTER_GTID_POS=AUTO.
Diffstat (limited to 'sql/slave.cc')
-rw-r--r-- | sql/slave.cc | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/sql/slave.cc b/sql/slave.cc index a16c56053f4..f39a1f18d5c 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -1792,10 +1792,29 @@ after_set_capability: char str_buf[256]; String connect_state(str_buf, sizeof(str_buf), system_charset_info); connect_state.length(0); + rpl_gtid *binlog_gtid_list= NULL; + uint32 num_binlog_gtids= 0; + + if (opt_bin_log) + { + int err= mysql_bin_log.get_most_recent_gtid_list(&binlog_gtid_list, + &num_binlog_gtids); + if (err) + { + err_code= ER_OUTOFMEMORY; + errmsg= "The slave I/O thread stops because a fatal out-of-memory " + "error is encountered when it tries to compute @slave_connect_state."; + sprintf(err_buff, "%s Error: Out of memory", errmsg); + goto err; + } + } connect_state.append(STRING_WITH_LEN("SET @slave_connect_state='"), system_charset_info); - rpl_global_gtid_slave_state.tostring(&connect_state); + rpl_global_gtid_slave_state.tostring(&connect_state, binlog_gtid_list, + num_binlog_gtids); + if (binlog_gtid_list) + my_free(binlog_gtid_list); connect_state.append(STRING_WITH_LEN("'"), system_charset_info); rc= mysql_real_query(mysql, connect_state.ptr(), connect_state.length()); if (rc) |