Debian Codegraph @

mysql-test/suite/binlog_gtid/t/binlog_replay_oct_cross_version.test

raw
1 # === Purpose ===
2 #
3 # This test checks that when a binlog is generated by a server unaware of
4 # original commit timestamp (OCT), if it is applied in a 8.0+ server, the OCT
5 # will be correctly generated.
6 #
7 # === Implementation ===
8 #
9 # First, generate some transactions on the server.
10 # Run mysqlbinlog modified so that the "SET original_commit_timestamp" statement
11 # is not printed.
12 # The server is then reset so that the transactions can be applied again.
13 # Finally, check that the OCT of the replayed transactions is set to zero, since
14 # they were not originated in this server.
15 #
16 # === Related Bug ===
17 #
18 # BUG#25316086 MYSQL 8.0 ASSUME TRX BEING APPLIED WITH 5.7- MYSQLBINLOG DUMP AS
19 # ORIGINAL
20
21 --source include/mysqlbinlog_have_debug.inc
22 --source include/have_debug.inc
23 --source include/have_log_bin.inc
24
25 RESET MASTER;
26
27 # Run some transactions on the master
28 --let $uuid=aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa
29
30 --eval SET SESSION GTID_NEXT= '$uuid:1'
31 CREATE TABLE t1 (a INT);
32 --eval SET SESSION GTID_NEXT= '$uuid:2'
33 DROP TABLE t1;
34 SET @@SESSION.GTID_NEXT= 'AUTOMATIC';
35
36 --let $binlog= query_get_value(SHOW MASTER STATUS, File, 1)
37 --let $binlog_path= `SELECT CONCAT(@@DATADIR, '$binlog')`
38
39 --echo # run mysqlbinlog with a flag so that the OCT is not printed
40 --echo # to simulate a 5.7 mysqlbinlog
41 --exec $MYSQL_BINLOG -#d,do_not_write_rpl_OCT --force-if-open $binlog_path > $MYSQLTEST_VARDIR/tmp/mysqlbinlog.sql
42
43 # reset the server so we can replay the transactions
44 RESET MASTER;
45 --echo # replay the transactions on the server
46 --exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/mysqlbinlog.sql
47
48 # check that the OCT of the two transactions is zero
49 --let $i= 1
50 while ($i < 3)
51 {
52 --let $gtid= $uuid:$i
53 --source include/get_original_commit_timestamp.inc
54
55 --let $assert_text= The OCT is zero for GTID $uuid:$i
56 --let $assert_cond= $original_commit_timestamp = 0
57 --source include/assert.inc
58 --inc $i
59 }
60
61 # cleanup
62 --remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog.sql