summaryrefslogtreecommitdiff
path: root/sql/rpl_mi.h
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/rpl_mi.h
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/rpl_mi.h')
-rw-r--r--sql/rpl_mi.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/sql/rpl_mi.h b/sql/rpl_mi.h
index af739b1dad4..ebb1b541728 100644
--- a/sql/rpl_mi.h
+++ b/sql/rpl_mi.h
@@ -136,6 +136,12 @@ class Master_info : public Slave_reporting_capability
DYNAMIC_ARRAY ignore_server_ids;
ulong master_id;
/*
+ At reconnect and until the first rotate event is seen, prev_master_id is
+ the value of master_id during the previous connection, used to detect
+ silent change of master server during reconnects.
+ */
+ ulong prev_master_id;
+ /*
Which kind of GTID position (if any) is used when connecting to master.
Note that you can not change the numeric values of these, they are used