Debian Codegraph @

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

raw
1
2 # The purpose of this test is to provide a reference for how the
3 # incident log event is represented in the output from the mysqlbinlog
4 # program.
5
6 source include/have_log_bin.inc;
7 #source include/have_innodb.inc;
8 # Test in this file is binlog format agnostic, thus no need
9 # to rerun it for every format.
10 --source include/have_binlog_format_row.inc
11 --source include/force_myisam_default.inc
12 --source include/have_myisam.inc
13
14 RESET MASTER;
15 call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
16 call mtr.add_suppression("Replica SQL for channel '': The incident LOST_EVENTS occurred on the source.");
17 call mtr.add_suppression("Non-transactional changes were not written to the binlog. An incident event has been written to the binary log which will stop the replicas.");
18
19 --let $old_max_binlog_stmt_cache_size= query_get_value(SHOW VARIABLES LIKE "max_binlog_stmt_cache_size", Value, 1)
20 --let $old_binlog_stmt_cache_size= query_get_value(SHOW VARIABLES LIKE "binlog_stmt_cache_size", Value, 1)
21 SET GLOBAL max_binlog_stmt_cache_size = 4096;
22 SET GLOBAL binlog_stmt_cache_size = 4096;
23
24 connect(con1,localhost,root,,);
25 --connection con1
26 --let $master_uuid=`SELECT @@SERVER_UUID`
27 --let $data= `SELECT CONCAT('"', repeat('a',2000), '"')`
28 --let $MYSQLD_DATADIR= `select @@datadir`
29 --let $start_pos= query_get_value("SHOW MASTER STATUS", Position, 1)
30 --let $master_binlog= query_get_value(SHOW MASTER STATUS, File, 1)
31
32 CREATE TABLE t1(c1 INT PRIMARY KEY, data TEXT(30000)) ENGINE=MyIsam;
33 --echo #
34 --echo # A single statement on non-transactional table causes to log an incident
35 --echo # event with an unique gtid due to the stmt_cache is not big enough to
36 --echo # accommodate the changes.
37 --echo #
38 --disable_query_log
39 --error ER_STMT_CACHE_FULL, ER_ERROR_ON_WRITE
40 eval INSERT INTO t1 (c1, data) VALUES (1,
41 CONCAT($data, $data, $data, $data, $data, $data));
42 --enable_query_log
43 --let $binlog_start= $start_pos
44 --source include/show_binlog_events.inc
45 DROP TABLE t1;
46
47 exec $MYSQL_BINLOG --start-position=$start_pos $MYSQLD_DATADIR/$master_binlog >$MYSQLTEST_VARDIR/tmp/binlog_incident-bug44442.sql;
48 --disable_query_log
49 eval SELECT cont LIKE '%RELOAD DATABASE; # Shall generate syntax error%' AS `Contain RELOAD DATABASE` FROM (SELECT load_file('$MYSQLTEST_VARDIR/tmp/binlog_incident-bug44442.sql') AS cont) AS tbl;
50 --enable_query_log
51
52 remove_file $MYSQLTEST_VARDIR/tmp/binlog_incident-bug44442.sql;
53
54 --replace_result $old_max_binlog_stmt_cache_size ORIGINAL_VALUE
55 --eval SET GLOBAL max_binlog_stmt_cache_size= $old_max_binlog_stmt_cache_size
56 --replace_result $old_binlog_stmt_cache_size ORIGINAL_VALUE
57 --eval SET GLOBAL binlog_stmt_cache_size= $old_binlog_stmt_cache_size
58 --disconnect con1