Commit b3e38170 authored by Andrei Elkin's avatar Andrei Elkin

MDEV-742 (intermediate commit)

typ == XID_EVENT || typ == XA_PREPARE_LOG_EVENT augmentation.
parent 21286d88
......@@ -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);
......
......@@ -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;
......
......@@ -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
......
......@@ -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())))
......
......@@ -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();
......
......@@ -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,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment