summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Elkin <andrei.elkin@mariadb.com>2019-08-26 14:05:33 +0300
committerAndrei Elkin <andrei.elkin@mariadb.com>2019-08-26 14:05:33 +0300
commitb3e381708f87e05b525ed393054d3253d5440fda (patch)
tree3f2fdb4e39711018d4f440f9456928bbd2c21e1f
parent21286d88d69952e75b46f9c67dc5297377ec53c3 (diff)
downloadmariadb-git-b3e381708f87e05b525ed393054d3253d5440fda.tar.gz
MDEV-742 (intermediate commit)MDEV-742-xa_repl
typ == XID_EVENT || typ == XA_PREPARE_LOG_EVENT augmentation.
-rw-r--r--mysql-test/suite/rpl/r/rpl_xa_gtid_pos_auto_engine.result1
-rw-r--r--mysql-test/suite/rpl/t/rpl_xa.inc18
-rw-r--r--sql/log_event.cc3
-rw-r--r--sql/rpl_parallel.cc4
-rw-r--r--sql/rpl_rli.cc4
-rw-r--r--sql/sql_repl.cc4
6 files changed, 27 insertions, 7 deletions
diff --git a/mysql-test/suite/rpl/r/rpl_xa_gtid_pos_auto_engine.result b/mysql-test/suite/rpl/r/rpl_xa_gtid_pos_auto_engine.result
index e8b4b054f1e..3b3e0a551b1 100644
--- a/mysql-test/suite/rpl/r/rpl_xa_gtid_pos_auto_engine.result
+++ b/mysql-test/suite/rpl/r/rpl_xa_gtid_pos_auto_engine.result
@@ -35,6 +35,7 @@ xa start 's';
insert into t2 values (0);
xa end 's';
xa prepare 's';
+include/save_master_gtid.inc
connection slave;
include/sync_with_master_gtid.inc
SELECT @@global.gtid_slave_pos = CONCAT(domain_id,"-",server_id,"-",seq_no) FROM mysql.gtid_slave_pos WHERE seq_no = (SELECT DISTINCT max(seq_no) FROM mysql.gtid_slave_pos);
diff --git a/mysql-test/suite/rpl/t/rpl_xa.inc b/mysql-test/suite/rpl/t/rpl_xa.inc
index c1300c1e27a..d5e6f56d439 100644
--- a/mysql-test/suite/rpl/t/rpl_xa.inc
+++ b/mysql-test/suite/rpl/t/rpl_xa.inc
@@ -11,7 +11,25 @@ xa start 't';
insert into t1 values(1, 2);
xa end 't';
xa prepare 't';
+# Debug with SLEEP
+#
+--disable_query_log
+--disable_result_log
+#select sleep(10000);
+--enable_result_log
+--enable_query_log
+#
+# End of Debug
xa commit 't';
+# Debug with SLEEP
+#
+--disable_query_log
+--disable_result_log
+#select sleep(10000);
+--enable_result_log
+--enable_query_log
+#
+# End of Debug
sync_slave_with_master;
let $diff_tables= master:t1, slave:t1;
diff --git a/sql/log_event.cc b/sql/log_event.cc
index a56bd1b560d..56b3343fe68 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -9006,7 +9006,8 @@ int Xid_apply_log_event::do_apply_event(rpl_group_info *rgi)
rpl_gtid gtid;
/*
- XID_EVENT works like a COMMIT statement. And it also updates the
+ An instance of this class such as XID_EVENT works like a COMMIT
+ statement. As well as XA_PREPARE_LOG_EVENT it also updates
mysql.gtid_slave_pos table with the GTID of the current transaction.
Therefore, it acts much like a normal SQL statement, so we need to do
diff --git a/sql/rpl_parallel.cc b/sql/rpl_parallel.cc
index dc5e3ff1fbf..91cf0428611 100644
--- a/sql/rpl_parallel.cc
+++ b/sql/rpl_parallel.cc
@@ -648,7 +648,7 @@ convert_kill_to_deadlock_error(rpl_group_info *rgi)
static int
is_group_ending(Log_event *ev, Log_event_type event_type)
{
- if (event_type == XID_EVENT)
+ if (event_type == XID_EVENT || event_type == XA_PREPARE_LOG_EVENT)
return 1;
if (event_type == QUERY_EVENT) // COMMIT/ROLLBACK are never compressed
{
@@ -2615,7 +2615,7 @@ rpl_parallel::do_event(rpl_group_info *serial_rgi, Log_event *ev,
else
{
DBUG_ASSERT(rli->gtid_skip_flag == GTID_SKIP_TRANSACTION);
- if (typ == XID_EVENT ||
+ if (typ == XID_EVENT || typ == XA_PREPARE_LOG_EVENT ||
(typ == QUERY_EVENT && // COMMIT/ROLLBACK are never compressed
(((Query_log_event *)ev)->is_commit() ||
((Query_log_event *)ev)->is_rollback())))
diff --git a/sql/rpl_rli.cc b/sql/rpl_rli.cc
index 0d8a5ad490b..45dfedcd582 100644
--- a/sql/rpl_rli.cc
+++ b/sql/rpl_rli.cc
@@ -2234,10 +2234,10 @@ void rpl_group_info::cleanup_context(THD *thd, bool error)
It could be done only after necessarily closing tables which dictates
the following placement.
*/
- XID_STATE *xid_state= &thd->transaction.xid_state;
- if (xid_state->is_explicit_XA())
+ if (thd->transaction.xid_state.is_explicit_XA())
{
xa_trans_force_rollback(thd);
+ attach_native_trx(thd);
}
thd->mdl_context.release_transactional_locks();
diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc
index a058c366f60..3ea9a2b52e1 100644
--- a/sql/sql_repl.cc
+++ b/sql/sql_repl.cc
@@ -1640,7 +1640,7 @@ is_until_reached(binlog_send_info *info, ulong *ev_offset,
return false;
break;
case GTID_UNTIL_STOP_AFTER_TRANSACTION:
- if (event_type != XID_EVENT &&
+ if (event_type != XID_EVENT && event_type != XA_PREPARE_LOG_EVENT &&
(event_type != QUERY_EVENT || /* QUERY_COMPRESSED_EVENT would never be commmit or rollback */
!Query_log_event::peek_is_commit_rollback
(info->packet->ptr()+*ev_offset,
@@ -1875,7 +1875,7 @@ send_event_to_slave(binlog_send_info *info, Log_event_type event_type,
info->gtid_skip_group= GTID_SKIP_NOT;
return NULL;
case GTID_SKIP_TRANSACTION:
- if (event_type == XID_EVENT ||
+ if (event_type == XID_EVENT || event_type == XA_PREPARE_LOG_EVENT ||
(event_type == QUERY_EVENT && /* QUERY_COMPRESSED_EVENT would never be commmit or rollback */
Query_log_event::peek_is_commit_rollback(packet->ptr() + ev_offset,
len - ev_offset,