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 /sql/rpl_rli.cc | |
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 'sql/rpl_rli.cc')
-rw-r--r-- | sql/rpl_rli.cc | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/sql/rpl_rli.cc b/sql/rpl_rli.cc index d21ebd494c1..673a8c7ca4f 100644 --- a/sql/rpl_rli.cc +++ b/sql/rpl_rli.cc @@ -1717,6 +1717,11 @@ void rpl_group_info::cleanup_context(THD *thd, bool error) trans_rollback_stmt(thd); // if a "statement transaction" /* trans_rollback() also resets OPTION_GTID_BEGIN */ trans_rollback(thd); // if a "real transaction" + /* + Now that we have rolled back the transaction, make sure we do not + errorneously update the GTID position. + */ + gtid_pending= false; } m_table_map.clear_tables(); slave_close_thread_tables(thd); |