Debian Codegraph @

mysql-test/suite/binlog/t/binlog_mysqlbinlog_intvar.test

raw
1 # === Purpose ===
2 #
3 # Verify 'mysqlbinlog --read-from-remote-server --hexdump' works for
4 # USER_VAR, RAND_LOG and INTVAR log events.
5 #
6 # === References ===
7 #
8 # Bug #24674276 MYSQLBINLOG -R --HEXDUMP CRASHES FOR INTVAR, USER_VAR, OR
9 # RAND EVENTS
10
11 # USER_VAR, RAND_LOG_EVENT and INTVAR_LOG_EVENT work with binlog_format
12 # statement.
13 --source include/have_binlog_format_statement.inc
14 call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. *");
15
16 # Initial setup
17 # Purge the existing binlog.
18 RESET MASTER;
19 --let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1)
20
21 CREATE TABLE t1 (i INT);
22 CREATE TABLE t2 (j INT PRIMARY KEY AUTO_INCREMENT);
23
24 # USER_VAR EVENT
25 SET @foo = 1;
26 INSERT INTO t1 VALUES (@foo);
27
28 # RAND_LOG_EVENT
29 INSERT INTO t1 VALUES (rand() * 10);
30
31 # INTVAR_LOG_EVENT
32 INSERT INTO t2 VALUES();
33 --exec $MYSQL_BINLOG --hexdump --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT $binlog_file > $MYSQLTEST_VARDIR/tmp/binlog_data.sql
34
35 DROP TABLE t1;
36 DROP TABLE t2;
37 RESET MASTER;
38
39 # Load the file and verify the inserted data.
40 --exec $MYSQL --user=root --host=127.0.0.1 --port=$MASTER_MYPORT < $MYSQLTEST_VARDIR/tmp/binlog_data.sql
41
42 --let $assert_text= The t1 table should have two entries.
43 --let $assert_cond= [SELECT count(*) FROM t1] = 2
44 --source include/assert.inc
45
46 --let $assert_text= The t2 table should have one entry.
47 --let $assert_cond= [SELECT count(*) FROM t2] = 1
48 --source include/assert.inc
49
50 # Cleanup
51 DROP TABLE t1;
52 DROP TABLE t2;
53 --remove_file $MYSQLTEST_VARDIR/tmp/binlog_data.sql
54 RESET MASTER;