summaryrefslogtreecommitdiff
path: root/sql/slave.cc
diff options
context:
space:
mode:
authorseppo <seppo.jaakola@iki.fi>2019-11-26 08:49:50 +0200
committerJan Lindström <jan.lindstrom@mariadb.com>2019-11-26 08:49:50 +0200
commit38839854b7c097b33f34b2228c4240fe837fda79 (patch)
tree6c6576d46f747bddc7abf62fab849da31aeea743 /sql/slave.cc
parenta51f3b09bb99f2927ce107727316caac2c426eb1 (diff)
downloadmariadb-git-38839854b7c097b33f34b2228c4240fe837fda79.tar.gz
MDEV-19572 async slave node fails to apply MyISAM only writes (#1418)
The problem happens when MariaDB master replicates writes for only non InnoDB tables (e.g. writes to MyISAM table(s)). Async slave node, in Galera cluster, can apply these writes successfully, but it will, in the end, write gtid position in mysql.gtid_slave_pos table. mysql.gtid_slave_pos table is InnoDB engine, and this write makes innodb handlerton part of the replicated "transaction". Note that wsrep patch identifies that write to gtid_slave_pos should not be replicated and skips appending wsrep keys for these writes. However, as InnoDB was present in the transaction, and there are replication events (for MyISAM table) in transaction cache, but there are no appended keys, wsrep raises an error, and this makes the söave thread to stop. The fix is simply to not treat it as an error if async slave tries to replicate a write set with binlog events, but no keys. We just skip wsrep replication and return successfully. This commit contains also a mtr test which forces mysql.gtid_slave_pos table isto be of InnoDB engine, and executes MyISAM only write through asyn replication. There is additional fix for declaring IO and background slave threads as non wsrep. These threads should not write anything for wsrep replication, and this is just a safeguard to make sure nothing leaks into cluster from these slave threads.
Diffstat (limited to 'sql/slave.cc')
-rw-r--r--sql/slave.cc7
1 files changed, 6 insertions, 1 deletions
diff --git a/sql/slave.cc b/sql/slave.cc
index bf8b8a43b15..c877a1e2c2c 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -306,6 +306,9 @@ handle_slave_background(void *arg __attribute__((unused)))
thd->store_globals();
thd->security_ctx->skip_grants();
thd->set_command(COM_DAEMON);
+#ifdef WITH_WSREP
+ thd->variables.wsrep_on= 0;
+#endif
thd_proc_info(thd, "Loading slave GTID position from table");
if (rpl_load_gtid_slave_state(thd))
@@ -4181,7 +4184,9 @@ pthread_handler_t handle_slave_io(void *arg)
goto err;
}
-
+#ifdef WITH_WSREP
+ thd->variables.wsrep_on= 0;
+#endif
if (RUN_HOOK(binlog_relay_io, thread_start, (thd, mi)))
{
mi->report(ERROR_LEVEL, ER_SLAVE_FATAL_ERROR, NULL,