diff options
author | unknown <knielsen@knielsen-hq.org> | 2013-03-21 12:16:04 +0100 |
---|---|---|
committer | unknown <knielsen@knielsen-hq.org> | 2013-03-21 12:16:04 +0100 |
commit | e590f89114bd205e30488cb8b1433f645babc170 (patch) | |
tree | e3ca77b7411c50a2a9655b6742f89c8294c09497 /sql/slave.cc | |
parent | 9bb989a9d196755fe411551f27e6198ef6819159 (diff) | |
download | mariadb-git-e590f89114bd205e30488cb8b1433f645babc170.tar.gz |
MDEV-26: Global transaction ID.
Fix MDEV-4278: Slave does not check that master understands GTID.
Now the slave will abort with a suitable error if an attempt is made to connect
with GTID to a master that does not support GTID.
Diffstat (limited to 'sql/slave.cc')
-rw-r--r-- | sql/slave.cc | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/sql/slave.cc b/sql/slave.cc index efbd12e04d5..f373c8b2c45 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -1823,6 +1823,27 @@ after_set_capability: rpl_gtid *binlog_gtid_list= NULL; uint32 num_binlog_gtids= 0; + /* + Read the master @@GLOBAL.gtid_domain_id variable. + This is mostly to check that master is GTID aware, but we could later + perhaps use it to check that different multi-source masters are correctly + configured with distinct domain_id. + */ + if (mysql_real_query(mysql, + STRING_WITH_LEN("SELECT @@GLOBAL.gtid_domain_id")) || + !(master_res= mysql_store_result(mysql)) || + !(master_row= mysql_fetch_row(master_res))) + { + err_code= mysql_errno(mysql); + errmsg= "The slave I/O thread stops because master does not support " + "MariaDB global transaction id. A fatal error is encountered when " + "it tries to SELECT @@GLOBAL.gtid_domain_id."; + sprintf(err_buff, "%s Error: %s", errmsg, mysql_error(mysql)); + goto err; + } + mysql_free_result(master_res); + master_res= NULL; + if (opt_bin_log) { int err= mysql_bin_log.get_most_recent_gtid_list(&binlog_gtid_list, |