1# ==== Purpose ==== 2# 3# Test verifies that when "Master_Delay" is specified on slave with GTIDS there 4# will not be any extra delay initially. 5# 6# ==== Implementation ==== 7# 8# Steps: 9# 0 - Stop the slave and execute CHANGE MASTER command with 10# master_use_gtid= curren_pos and master_delay= 10 11# 1 - On slave introduce a sleep of 15 seconds and check that the 12# Seconds_Behind_Master is within specified master_delay limit. It should 13# not be more that "10" seconds. 14# 15# ==== References ==== 16# 17# MDEV-13895: GTID and Master_Delay causes excessive initial delay 18 19--source include/have_binlog_format_mixed.inc 20--source include/master-slave.inc 21 22CREATE TABLE t1 (i INT); 23--sync_slave_with_master 24 25--source include/stop_slave.inc 26CHANGE MASTER TO MASTER_USE_GTID= current_pos, MASTER_DELAY= 10; 27--source include/start_slave.inc 28 29--connection master 30INSERT INTO t1 VALUES (1); 31--source include/sync_slave_io_with_master.inc 32 33--connection slave 34--let $actual_delay= query_get_value(SHOW SLAVE STATUS, SQL_Delay, 1) 35--let $sleep_time= `SELECT 5 + $actual_delay` 36--echo "Sleeping for $sleep_time" 37--sleep $sleep_time 38 39--let $assert_cond= [SHOW SLAVE STATUS, Seconds_Behind_Master, 1] <= 10 40--let $assert_text= Seconds_Behind_Master should be less than MASTER_DELAY 41--source include/rpl_assert.inc 42 43# The row should be available in table after master_delay=20 seconds. 44--let $assert_text= One row shoule be found in table t1. 45--let $assert_cond= COUNT(*) = 1 FROM t1 46--source include/rpl_assert.inc 47 48--echo "======= Clean up ========" 49STOP SLAVE; 50CHANGE MASTER TO MASTER_USE_GTID=no, MASTER_DELAY=0; 51START SLAVE; 52 53--connection master 54DROP TABLE t1; 55--sync_slave_with_master 56 57--connection master 58--source include/rpl_end.inc 59