From bc6121819cf648237d0c2c63e48d53acf816db76 Mon Sep 17 00:00:00 2001 From: Andrei Elkin Date: Mon, 16 Dec 2024 19:34:09 +0200 Subject: [PATCH] MDEV-35098 rpl.rpl_mysqldump_gtid_slave_pos fails in buildbot The test turns out to be senstive to @@global.gtid_cleanup_batch_size. With a rather small default value of the latter SELECTing from mysql.gtid_slave_pos may not be deterministic: tests that run before may increase a pending for automitic deletion batch. The test is refined to set its own value for the batch size which is virtually unreachable. Thanks to Kristian Nielsen for the analysis. --- .../suite/rpl/r/rpl_mysqldump_gtid_slave_pos.result | 4 ++++ mysql-test/suite/rpl/t/rpl_mysqldump_gtid_slave_pos.test | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/mysql-test/suite/rpl/r/rpl_mysqldump_gtid_slave_pos.result b/mysql-test/suite/rpl/r/rpl_mysqldump_gtid_slave_pos.result index 1849f896758..9340498c537 100644 --- a/mysql-test/suite/rpl/r/rpl_mysqldump_gtid_slave_pos.result +++ b/mysql-test/suite/rpl/r/rpl_mysqldump_gtid_slave_pos.result @@ -32,6 +32,7 @@ insert into t1 set a = 2; insert into t1 set a = 1; include/save_master_gtid.inc connection slave; +SET @@global.gtid_cleanup_batch_size = $val; include/start_slave.inc include/sync_with_master_gtid.inc select * from mysql.gtid_slave_pos; @@ -55,6 +56,7 @@ set statement sql_log_bin=0 for delete from mysql.gtid_slave_pos; insert into mysql.gtid_slave_pos values (99 + 2, 1, 1, 1); # 5. include/rpl_restart_server.inc [server_number=2] +SET @@global.gtid_cleanup_batch_size = $val; select * from mysql.gtid_slave_pos; domain_id sub_id server_id seq_no 101 1 1 1 @@ -99,6 +101,7 @@ set statement sql_log_bin=0 for delete from mysql.gtid_slave_pos; insert into mysql.gtid_slave_pos values (99 + 1, 1, 1, 1); # 5. include/rpl_restart_server.inc [server_number=2] +SET @@global.gtid_cleanup_batch_size = $val; select * from mysql.gtid_slave_pos; domain_id sub_id server_id seq_no 100 1 1 1 @@ -145,5 +148,6 @@ connection master; DROP TABLE t1; include/save_master_gtid.inc connection slave; +SET @@global.gtid_cleanup_batch_size= $old_gtid_cleanup_batch_size; include/sync_with_master_gtid.inc include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_mysqldump_gtid_slave_pos.test b/mysql-test/suite/rpl/t/rpl_mysqldump_gtid_slave_pos.test index e66a92a6153..820fc56134b 100644 --- a/mysql-test/suite/rpl/t/rpl_mysqldump_gtid_slave_pos.test +++ b/mysql-test/suite/rpl/t/rpl_mysqldump_gtid_slave_pos.test @@ -47,6 +47,12 @@ while ($i) --source include/save_master_gtid.inc --connection slave +# enforce determistic SELECT * from mysql.gtid_slave_pos +--let $old_gtid_cleanup_batch_size = `select @@GLOBAL.gtid_cleanup_batch_size` +# the number of generated transactions on master must not exceed this value: +--let $val= 2147483647 +--evalp SET @@global.gtid_cleanup_batch_size = $val + --source include/start_slave.inc --source include/sync_with_master_gtid.inc # Prior tests in a mtr batch could leave the min value of sub_id column with @@ -85,6 +91,7 @@ while ($i) --echo # 5. --let $rpl_server_number= 2 --source include/rpl_restart_server.inc + --evalp SET @@global.gtid_cleanup_batch_size = $val select * from mysql.gtid_slave_pos; select @@global.gtid_slave_pos as "before dump restore"; --let $dump=dump_$i.sql @@ -130,6 +137,7 @@ DROP TABLE t1; --source include/save_master_gtid.inc --connection slave +--evalp SET @@global.gtid_cleanup_batch_size= $old_gtid_cleanup_batch_size --remove_files_wildcard $MYSQLTEST_VARDIR/tmp dump_*.sql --source include/sync_with_master_gtid.inc