summaryrefslogtreecommitdiff
path: root/sql/log.cc
diff options
context:
space:
mode:
authorKristian Nielsen <knielsen@knielsen-hq.org>2014-09-02 14:07:01 +0200
committerKristian Nielsen <knielsen@knielsen-hq.org>2014-09-02 14:07:01 +0200
commit36f50be970fb2a42cd8d3b7c7cc7bba672574f63 (patch)
tree165be28646624cc930ab76ba7f5d5123e3d450d4 /sql/log.cc
parentfbaaf3688d5fac4b1b867155a9f09575367c0f98 (diff)
downloadmariadb-git-36f50be970fb2a42cd8d3b7c7cc7bba672574f63.tar.gz
MDEV-6462: Slave replicating using GTID doesn't recover correctly when master crashes in the middle of transaction
If the slave gets a reconnect in the middle of a GTID event group, normally it will re-fetch that event group, skipping the first part that was already queued for the SQL thread. However, if the master crashed while writing the event group, the group is incomplete. This patch detects this case and makes sure that the transaction is rolled back and nothing is skipped from any following event groups. Similarly, a network proxy might cause the reconnect to end up on a different master server. Detect this by noticing a different server_id, and similarly in this case roll back the partially received group.
Diffstat (limited to 'sql/log.cc')
-rw-r--r--sql/log.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/sql/log.cc b/sql/log.cc
index 71975cd83b7..e6d9b6d15cb 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -7469,6 +7469,13 @@ MYSQL_BIN_LOG::write_transaction_or_stmt(group_commit_entry *entry,
}
}
+ DBUG_EXECUTE_IF("inject_error_writing_xid",
+ {
+ entry->error_cache= NULL;
+ entry->commit_errno= 28;
+ DBUG_RETURN(ER_ERROR_ON_WRITE);
+ });
+
if (entry->end_event->write(&log_file))
{
entry->error_cache= NULL;