polardbxengine/mysql-test/suite/rpl_gtid/t/rpl_gtid_mysqlbinlog_rotate...

68 lines
2.5 KiB
Plaintext

################################################################################
# BUG#20980932 MYSQLBINLOG GENERATES 'ROLLBACK' AFTER FD EVENT CAUSING 1782
# ERRRO
#
# mysqlbinlog prints "ROLLBACK" at the end of binlog file. The ROLLBACK
# caused the error that "@@SESSION.GTID_NEXT cannot be set to ANONYMOUS
# when @@GLOBAL.GTID_MODE = ON."
#
# It happened in below two cases:
# - Case1. Binlog file doesn't include any data related events.
# e.g. The binlog only includes:
# Format_description_log_event
# Rotate_log_event
#
# and mysqlbinlog output:
# BINLOG '... the binary of Format_description_log_event ...'
# ROLLBACK
#
# - Case2. Relay log file includes a Format_description_log_event of master
# which is generated at starting server.
# e.g. the relay log includes:
# Format_description_log_event of relay log
# Format_description_log_event of master(generated when starting server)
#
# and mysqlbinlog output:
# BINLOG '... the binary of relay log's Format_description_log_event'
# ROLLBACK
# BINLOG '... the binary of master's Format_description_log_event'
#
# To fix it:
# - ROLLBACK is not printed if there is no uncomplete transaction at the end
# of a binlog.
# - Format_description_log_event of relay log is not output as a 'BINLOG'.
# - SET @@SESSION.GTID_NEXT = 'AUTOMATIC' is always printed out at the end of
# a binlog. It is after the 'ROLLBACK' if the last transaction is
# uncomplete.
#
# This test verify above two cases work well.
################################################################################
--source include/have_binlog_format_row.inc
--echo #
--echo # Verify Case2 works well
--echo #
--source include/master-slave.inc
--let $master_file1 = query_get_value(SHOW MASTER STATUS, File, 1)
--let $MASTER_DATADIR=`select @@datadir`
--source include/rpl_connection_slave.inc
--let $SLAVE_DATADIR=`select @@datadir`
--let $relay_file1 = query_get_value(SHOW SLAVE STATUS, Relay_Log_File, 1)
--exec $MYSQL_BINLOG --force-if-open $SLAVE_DATADIR/$relay_file1 | $MYSQL -uroot -S$MASTER_MYSOCK
--exec $MYSQL_BINLOG --force-if-open $SLAVE_DATADIR/$relay_file1 | $MYSQL -uroot -S$SLAVE_MYSOCK
--echo #
--echo # Verify Case1 works well
--echo #
--source include/rpl_connection_master.inc
FLUSH BINARY LOGS;
--let $master_file2 = query_get_value(SHOW MASTER STATUS, File, 1)
--exec $MYSQL_BINLOG --force-if-open $MASTER_DATADIR/$master_file1 $MASTER_DATADIR/$master_file2 | $MYSQL -uroot -S$SLAVE_MYSOCK
--source include/rpl_end.inc