Debian Codegraph @

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

raw
1 source include/have_innodb.inc;
2 source include/have_debug.inc;
3 source include/have_log_bin.inc;
4 source include/have_binlog_format_mixed.inc;
5
6 --echo *** MDEV-25611: RESET MASTER hangs waiting for InnoDB to flush its log
7 # Error injection to minimize extra log flushing inside innodb.
8 SET @old_dbug= @@global.DEBUG_DBUG;
9 SET GLOBAL debug_dbug="+d,ib_log_checkpoint_avoid";
10 # Couple other settings that reduce redo log flushing, thus potentially
11 # triggering the hang.
12 SET @old_flush= @@GLOBAL.innodb_flush_log_at_trx_commit;
13 SET GLOBAL innodb_flush_log_at_trx_commit= 0;
14 SET @old_flush_timeout= @@GLOBAL.innoDB_flush_log_at_timeout;
15 SET GLOBAL innoDB_flush_log_at_timeout=2700;
16
17 --connection default
18 CREATE TABLE t1 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB STATS_PERSISTENT=0;
19 INSERT INTO t1 VALUES (1,1);
20 INSERT INTO t1 VALUES (2,1);
21 INSERT INTO t1 VALUES (3,1);
22
23 connect (stop_purge,localhost,root,,);
24 # This blocks purge due to old data being still visible.
25 START TRANSACTION WITH CONSISTENT SNAPSHOT;
26
27 --connection default
28 INSERT INTO t1 VALUES (4,2);
29 DELETE FROM t1 WHERE a in (1,2,3);
30
31 # Rotate the binlog and wait for everything to settle down and latest binlog
32 # checkpoint to be done. The small sleep helps trigger the bug more reliably
33 # before the fix.
34 FLUSH BINARY LOGS;
35 --sleep 0.1
36
37 # Now unblock the purge, and wait for some purge records to be written
38 # to the redo log so the LSN is incremented but will not be synced to
39 # disk until something else happens.
40 --connection stop_purge
41 ROLLBACK;
42 --connection default
43 --disconnect stop_purge
44
45 --sleep 0.1
46
47 # Now see if RESET MASTER will request and wait for a binlog checkpoint that is never reported.
48 RESET MASTER;
49
50 # Clean up.
51 --connection default
52 DROP TABLE t1;
53 SET GLOBAL debug_dbug= @old_dbug;
54 SET GLOBAL innodb_flush_log_at_trx_commit= @old_flush;
55 SET GLOBAL innoDB_flush_log_at_timeout= @old_flush_timeout;