Debian Codegraph @

mysql-test/suite/rpl/t/rpl_row_binlog_tmp_file_flush_enospc.test

raw
1 #
2 # This test ensures that a large transaction (i.e. one whose data exceeds the
3 # binlog_cache_size limit and spills into a tmp file) that errors while
4 # flushing the tmp file (e.g. due to no space on disk) does not corrupt the
5 # binlog, and that the server/replication can continue working normally after
6 # the error. To simulate the error, the test uses debug_dbug to inject a
7 # failure in the my_write() function, which is called when flushing the tmp
8 # file.
9 #
10 # References:
11 # MDEV-37662: Binlog Corruption When tmpdir is Full
12 #
13 --source include/have_debug.inc
14 --source include/have_innodb.inc
15 --source include/have_binlog_format_row.inc
16 --source include/master-slave.inc
17
18 --connection master
19 set @old_binlog_cache_size= @@global.binlog_cache_size;
20 set @@global.binlog_cache_size=4096;
21 CALL mtr.add_suppression('Error writing file');
22
23 --echo #
24 --echo # Initialize test data
25 --connection master
26 create table t1 (a int, b longtext default NULL) engine=innodb;
27
28 --echo #
29 --echo # Create transaction with cache data larger than the binlog_cache_size
30 --echo # so it spills into a tmp file, then simulate ENOSPC while flushing
31 --echo # the tmp file.
32 --echo #
33 set @@session.debug_dbug="+d,simulate_binlog_tmp_file_no_space_left_on_flush";
34 --replace_regex /Error writing file '[^']+\/(tmp|#binlog_cache_files)\/[^']+'/Error writing file '...\/tmp\/<FILENAME>'/
35 --error 3
36 insert into t1 values (2, repeat("y", 8192));
37 set @@session.debug_dbug="";
38
39 --echo #
40 --echo # Create another transaction to make sure the server/replication can
41 --echo # continue working normally after the error
42 --echo #
43 insert into t1 values (3, repeat("z", 8192));
44 --source include/save_master_gtid.inc
45 --connection slave
46 --source include/sync_with_master_gtid.inc
47
48 --let $diff_tables=master:test.t1,slave:test.t1
49 --source include/diff_tables.inc
50
51 --echo #
52 --echo # Cleanup
53 --connection master
54 drop table t1;
55 --source include/save_master_gtid.inc
56
57 --connection slave
58 --source include/sync_with_master_gtid.inc
59
60 --connection master
61 set @@global.binlog_cache_size= @old_binlog_cache_size;
62
63 --source include/rpl_end.inc
64 --echo # End of rpl_row_binlog_tmp_file_flush_enospc.test