Description:
Pervious-gtid lost gtid in binlog file.
How to repeat:
Here is an MTR test case.Pervious-gtid from master-bin.000003 lost a gtid.
//bug_pervious_gtid_event_in_binlog-master.opt
--binlog_order_commits=off --gtid_mode=on --enforce_gtid_consistency=true
//bug_pervious_gtid_event_in_binlog.test
--source include/have_log_bin.inc
--source include/have_gtid.inc
#
# We need the Debug Sync Facility.
#
--source include/have_debug_sync.inc
show variables like 'binlog_order_commits';
--echo ###########################
--echo # prepare #
--echo ###########################
show binary logs;
connect (con1,localhost,root,,);
connect (con2,localhost,root,,);
connection default;
# Clean up resources used in this test case.
--disable_warnings
SET DEBUG_SYNC= 'RESET';
--enable_warnings
let $MYSQLD_DATADIR= `select @@datadir`;
create table t(id int);
flush logs;
--echo ###########################
--echo # test #
--echo ###########################
--echo #session 1: drop table t
connection con1;
set debug_sync='finish_commit_before_update_executed_gtid WAIT_FOR go';
send
drop table t;
--sleep 1
--echo #session 2: flush logs
connection con2;
flush logs;
set debug_sync='now SIGNAL go';
show binary logs;
connection con1;
--reap
flush logs;
flush logs;
show binary logs;
--echo #######################################################
--echo # binlog:master-bin.000001 #
--echo #######################################################
--exec $MYSQL_BINLOG --server-id=1 $MYSQLD_DATADIR/master-bin.000001
--echo #######################################################
--echo # binlog:master-bin.000002 #
--echo #######################################################
--exec $MYSQL_BINLOG --server-id=1 $MYSQLD_DATADIR/master-bin.000002
--echo #######################################################
--echo # binlog:master-bin.000003 #
--echo #######################################################
--echo # Here's the problem.
--echo # Pervious -gtid from master-bin.000003 lost a gtid.
--echo #
--exec $MYSQL_BINLOG --server-id=1 $MYSQLD_DATADIR/master-bin.000003
--echo #######################################################
--echo # binlog:master-bin.000004 #
--echo #######################################################
--exec $MYSQL_BINLOG --server-id=1 $MYSQLD_DATADIR/master-bin.000004
disconnect con1;
disconnect con2;
connection default;
# Clean up resources used in this test case.
--disable_warnings
SET DEBUG_SYNC= 'RESET';
--enable_warnings