--source include/have_innodb.inc --source include/have_aria.inc --source include/have_log_bin.inc # References: # # MDEV-24526 binlog rotate via FLUSH LOGS may obsolate binlog file too eary # # The test proves MDEV-24526 fixes sustain a combo of # concurrent Transaction load, MyISAM updates, FLUSH-LOGS:s, RESET MASTER, # FTWRL on master and slave. # SET @old_max_binlog_size= @@global.max_binlog_size; SET GLOBAL max_binlog_size= 4096; SET @old_innodb_flush_log_at_trx_commit= @@global.innodb_flush_log_at_trx_commit; SET GLOBAL innodb_flush_log_at_trx_commit= 1; RESET MASTER; CREATE TABLE t1 (a INT PRIMARY KEY AUTO_INCREMENT, b MEDIUMTEXT) ENGINE=Innodb; CREATE TABLE t2 (a INT PRIMARY KEY AUTO_INCREMENT, b MEDIUMTEXT) ENGINE=Aria; delimiter |; CREATE PROCEDURE p1(len INT, num_i INT) BEGIN DECLARE a_max INT; DECLARE i INT; SET i = 0; SELECT max(a) FROM t1 INTO a_max; WHILE i < num_i do INSERT INTO t1 VALUES (NULL, REPEAT("x", len)); SET i = i + 1; END while; INSERT INTO t2 VALUES (NULL, REPEAT("x", len)); UPDATE t1 SET b = REPEAT("x", 1) WHERE a = a_max; DELETE FROM t1 WHERE a = a_max + 1; END| delimiter ;| --disable_query_log # # Master server load configuration # --let $conn_number = 40 --let $reset_master_period = 100 --let $call_num = 5000 --let $i=0 while ($i < $conn_number) { --connect (conn$i, 127.0.0.1,root,,test,$MASTER_MYPORT,) --inc $i } --let $flush_number=10 --let $i=0 while ($i < $flush_number) { --connect (flush$i, 127.0.0.1,root,,test,$MASTER_MYPORT,) --inc $i } --let $k=0 while ($k < $call_num) { --let $i=0 while ($i < $conn_number) { --connection conn$i --let $len = `SELECT floor(rand()*5000)` --let $num = `SELECT ceil(rand()*10)` --let $t = `SELECT if(floor(rand()*10) % 2 = 1, "t1", "t2")` # --send_eval INSERT INTO $t VALUES (NULL, REPEAT("x", $len)) --send_eval call p1($len, $num) --inc $i } --let $i=0 while ($i < $flush_number) { --connection flush$i --let $zero_p = `SELECT ($k+$i)%$reset_master_period = 0` --send FLUSH LOGS if ($zero_p) { --reap --send_eval RESET MASTER } --inc $i } --let $i=0 while ($i < $conn_number) { --connection conn$i --reap --inc $i } --let $i=0 while ($i < $flush_number) { --connection flush$i --reap --inc $i } --inc $k } # end of k-while --enable_query_log # Clean up. connection default; DROP PROCEDURE p1; DROP TABLE t1, t2; SET GLOBAL innodb_flush_log_at_trx_commit= @old_innodb_flush_log_at_trx_commit; SET GLOBAL max_binlog_size= @old_max_binlog_size;