diff options
author | Kristian Nielsen <knielsen@knielsen-hq.org> | 2014-11-25 12:19:48 +0100 |
---|---|---|
committer | Kristian Nielsen <knielsen@knielsen-hq.org> | 2014-11-25 12:19:48 +0100 |
commit | b79685902d95df2c98544e8171b92cb09417328e (patch) | |
tree | d9f8a4be3243c0db761a512a3cc78932e4c41fc7 /mysql-test/suite/rpl/r/rpl_gtid_crash.result | |
parent | f3bdf9d7415bb498a32b42ef9ca10f9ac48a15fe (diff) | |
download | mariadb-git-b79685902d95df2c98544e8171b92cb09417328e.tar.gz |
MDEV-6903: gtid_slave_pos is incorrect after master crash
When a master slave restarts, it logs a special restart format description
event in its binlog. When the slave sees this event, it knows it needs to roll
back any active partial transaction, in case the master crashed previously in
the middle of writing such transaction to its binlog.
However, there was a bug where this rollback did not reset rgi->pending_gtid.
This caused the @@gtid_slave_pos to be updated incorrectly with the GTID of
the partial transaction that was rolled back.
Fix this by always clearing rgi->pending_gtid in cleanup_context(), hopefully
preventing similar bugs from turning up in other special cases where a
transaction is rolled back during replication.
Thanks to Pavel Ivanov for tracking down the issue and providing a test case.
Diffstat (limited to 'mysql-test/suite/rpl/r/rpl_gtid_crash.result')
-rw-r--r-- | mysql-test/suite/rpl/r/rpl_gtid_crash.result | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/mysql-test/suite/rpl/r/rpl_gtid_crash.result b/mysql-test/suite/rpl/r/rpl_gtid_crash.result index 3417ad561f4..bbe1dfc6c5f 100644 --- a/mysql-test/suite/rpl/r/rpl_gtid_crash.result +++ b/mysql-test/suite/rpl/r/rpl_gtid_crash.result @@ -133,9 +133,17 @@ SELECT @@GLOBAL.server_id; 3 SELECT * from t1 WHERE a > 10 ORDER BY a; a +gtid_check +Binlog pos ok # Wait 30 seconds for SQL thread to catch up with IO thread SELECT * from t1 WHERE a > 10 ORDER BY a; a +gtid_check +Binlog pos ok +gtid_check +Slave pos ok +gtid_check +Current pos ok # Repeat this with additional transactions on the master SET GLOBAL debug_dbug="+d,inject_error_writing_xid"; BEGIN; @@ -175,11 +183,21 @@ SELECT * from t1 WHERE a > 10 ORDER BY a; a 13 14 +gtid_check +Binlog pos ok +gtid_check +Current pos ok # Wait 30 seconds for SQL thread to catch up with IO thread SELECT * from t1 WHERE a > 10 ORDER BY a; a 13 14 +gtid_check +Binlog pos ok +gtid_check +Slave pos ok +gtid_check +Current pos ok # Repeat this with additional transactions on the master SET GLOBAL debug_dbug="+d,inject_error_writing_xid"; BEGIN; @@ -205,5 +223,48 @@ a 14 23 24 +# Repeat this with slave restart +SET GLOBAL debug_dbug="+d,inject_error_writing_xid"; +BEGIN; +INSERT INTO t1 VALUES (25); +COMMIT; +ERROR HY000: Error writing file 'master-bin' (errno: 28 "No space left on device") +SET GLOBAL debug_dbug="+d,crash_dispatch_command_before"; +COMMIT; +Got one of the listed errors +# Wait 30 seconds for IO thread to connect and SQL thread to catch up +# with IO thread. +include/stop_slave.inc +gtid_check +Binlog pos ok +gtid_check +Current pos ok +INSERT INTO t1 VALUES (26); +INSERT INTO t1 VALUES (27); +SELECT * from t1 WHERE a > 10 ORDER BY a; +a +13 +14 +23 +24 +26 +27 +include/save_master_gtid.inc +gtid_check +Binlog pos ok +gtid_check +Slave pos ok +gtid_check +Current pos ok +include/start_slave.inc +include/sync_with_master_gtid.inc +SELECT * from t1 WHERE a > 10 ORDER BY a; +a +13 +14 +23 +24 +26 +27 DROP TABLE t1; include/rpl_end.inc |