Debian Codegraph @

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

raw
1 ################################################################################
2 # BUG#20980932 MYSQLBINLOG GENERATES 'ROLLBACK' AFTER FD EVENT CAUSING 1782
3 # ERRRO
4 #
5 # mysqlbinlog prints "ROLLBACK" at the end of binlog file. The ROLLBACK
6 # caused the error that "@@SESSION.GTID_NEXT cannot be set to ANONYMOUS
7 # when @@GLOBAL.GTID_MODE = ON."
8 #
9 # It happened in below two cases:
10 # - Case1. Binlog file doesn't include any data related events.
11 # e.g. The binlog only includes:
12 # Format_description_log_event
13 # Rotate_log_event
14 #
15 # and mysqlbinlog output:
16 # BINLOG '... the binary of Format_description_log_event ...'
17 # ROLLBACK
18 #
19 # - Case2. Relay log file includes a Format_description_log_event of master
20 # which is generated at starting server.
21 # e.g. the relay log includes:
22 # Format_description_log_event of relay log
23 # Format_description_log_event of master(generated when starting server)
24 #
25 # and mysqlbinlog output:
26 # BINLOG '... the binary of relay log's Format_description_log_event'
27 # ROLLBACK
28 # BINLOG '... the binary of master's Format_description_log_event'
29 #
30 # To fix it:
31 # - ROLLBACK is not printed if there is no uncomplete transaction at the end
32 # of a binlog.
33 # - Format_description_log_event of relay log is not output as a 'BINLOG'.
34 # - SET @@SESSION.GTID_NEXT = 'AUTOMATIC' is always printed out at the end of
35 # a binlog. It is after the 'ROLLBACK' if the last transaction is
36 # uncomplete.
37 #
38 # This test verify above two cases work well.
39 ################################################################################
40 --source include/have_binlog_format_row.inc
41
42 --echo #
43 --echo # Verify Case2 works well
44 --echo #
45 --source include/master-slave.inc
46 --let $master_file1 = query_get_value(SHOW MASTER STATUS, File, 1)
47 --let $MASTER_DATADIR=`select @@datadir`
48
49 --source include/rpl_connection_slave.inc
50
51 --let $SLAVE_DATADIR=`select @@datadir`
52 --let $relay_file1 = query_get_value(SHOW SLAVE STATUS, Relay_Log_File, 1)
53
54 --exec $MYSQL_BINLOG --force-if-open $SLAVE_DATADIR/$relay_file1 | $MYSQL -uroot -S$MASTER_MYSOCK
55 --exec $MYSQL_BINLOG --force-if-open $SLAVE_DATADIR/$relay_file1 | $MYSQL -uroot -S$SLAVE_MYSOCK
56
57 --echo #
58 --echo # Verify Case1 works well
59 --echo #
60 --source include/rpl_connection_master.inc
61 FLUSH BINARY LOGS;
62
63 --let $master_file2 = query_get_value(SHOW MASTER STATUS, File, 1)
64
65 --exec $MYSQL_BINLOG --force-if-open $MASTER_DATADIR/$master_file1 $MASTER_DATADIR/$master_file2 | $MYSQL -uroot -S$SLAVE_MYSOCK
66
67 --source include/rpl_end.inc