summaryrefslogtreecommitdiff
path: root/sql/rpl_gtid.cc
diff options
context:
space:
mode:
authorunknown <knielsen@knielsen-hq.org>2013-06-07 10:58:34 +0200
committerunknown <knielsen@knielsen-hq.org>2013-06-07 10:58:34 +0200
commit03aa4876e187fcb7dbae6d43170345d2a25fb0e7 (patch)
tree4b473603324310fe99b713bf6150cd3494594d07 /sql/rpl_gtid.cc
parentdbe2c5060edec13d591d176df08d0fc07c3aa6dd (diff)
downloadmariadb-git-03aa4876e187fcb7dbae6d43170345d2a25fb0e7.tar.gz
MDEV-4486: Allow to start old-style replication even if mysql.rpl_slave_state is unavailable
If the mysql.gtid_slave_pos table is not available, we cannot load nor update the current GTID position persistently. This can happen eg. after an upgrade, before mysql_upgrade_db is run, or if the table is InnoDB and the server is restarted without the InnoDB storage engine enabled. Before, replication always failed to start if the table was unavailable. With this patch, we try to continue with old-style replication, after suitable complaints in the error log. In strict mode, or if slave is configured to use GTID, slave still refuses to start.
Diffstat (limited to 'sql/rpl_gtid.cc')
-rw-r--r--sql/rpl_gtid.cc12
1 files changed, 12 insertions, 0 deletions
diff --git a/sql/rpl_gtid.cc b/sql/rpl_gtid.cc
index d5e9380296e..71b18e64842 100644
--- a/sql/rpl_gtid.cc
+++ b/sql/rpl_gtid.cc
@@ -311,6 +311,18 @@ rpl_slave_state::record_gtid(THD *thd, const rpl_gtid *gtid, uint64 sub_id,
ulonglong thd_saved_option= thd->variables.option_bits;
Query_tables_list lex_backup;
+ if (unlikely(!loaded))
+ {
+ /*
+ Probably the mysql.gtid_slave_pos table is missing (eg. upgrade) or
+ corrupt.
+
+ We already complained loudly about this, but we can try to continue
+ until the DBA fixes it.
+ */
+ return 0;
+ }
+
if (!in_statement)
mysql_reset_thd_for_next_command(thd, 0);